title: Sort ArrayList of Array in Java
body: <p>What is the best way to sort an <code>ArrayList&lt;String[]&gt;</code> in Java?</p>
  <p>Where <code>String[]</code> is...</p>
  <pre><code>String[] strAarray = new String[] { &quot;abc&quot;, &quot;abc&quot;, &quot;abc&quot;, &quot;abc&quot;, &quot;abc&quot;, &quot;abc&quot;, &quot;abc&quot; };
  </code></pre>
  <p>Now I want to sort the whole ArrayList by the 2nd value of <code>String[]</code> (at index 1). I need to loop through each and every <code>String[]</code> and then its child at index 1.</p>
  <p>Any ideas?</p>
  <p>Edit:</p>
  <hr />
  <p>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 <code>String[]</code> which is holding those school nodes from XML and <code>String[] strArray</code> itself is holding attributes of particular node.</p>
  <p>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 <code>String[]</code> inside ArrayList.</p>
  <p>I need to loop through each and every School first (node in XML, <code>String[]</code> in Java) and then I will have to filter State (State attribute in XML, <code>String[1]</code> in Java).</p>