title: Java sort map or array
body: <p>I have code:</p>
  
  <pre><code>    List&lt;ModelMap&gt; nameCustomer = new ArrayList&lt;ModelMap&gt;();
  
      for (int i=1;i&lt;150;i++) {
                      ModelMap map = new ModelMap();
                      map.put("name", "nazwa " + i);
                      map.put("surname", "nazwisko " + i);
                      map.put("number", "123 ");
                      nameCustomer.add(map);
                  }
  
              ModelMap[] result = new ModelMap[nameCustomer.size()];
              ModelMap[] rowsArray = nameCustomer.toArray(result);
  </code></pre>
  
  <p>How can I sort nameCustomer (or rowsArray) by surname or number?</p>