KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the best way to sort an ArrayList<String[]> in Java? Where String[] is... String[] strAarray = new String[] { "abc", "abc", "abc", "abc", "abc", "abc", "abc" }; Now I want to sort the whole ArrayList by the 2nd value of String[] (at index 1). I need to loop through each and every String[] and then its child at index 1. Any ideas? Edit: I have more descriptions. I am actually getting schools from some XML file and every node in XML has 7 attributes. Now I am creating an ArrayList of String[] which is holding those school nodes from XML and String[] strArray itself is holding attributes of particular node. Now, the way I want to sort it is, it should sort according to State of school which is the 2nd attribute in XML and index 1 in String[] inside ArrayList. I need to loop through each and every School first (node in XML, String[] in Java) and then I will have to filter State (State attribute in XML, String[1] in Java).
Tags (comma-separated)
Save Edits
Cancel