title: Order List of LinkedHashMap
body: <p>I have this list of LinkedHashMap how can order for value?</p>
  
  <pre><code>    List&lt;LinkedHashMap&lt;String, Object&gt;&gt; list = more "key:value"......
  </code></pre>
  
  <p>For example on my list i have:</p>
  
  <pre><code>    [{"field1": "z", "field2":"a"},
       {"field1" : "b", "field2":"x"}]
  </code></pre>
  
  <p>and i want order based on the values of the "field1" keys for example:</p>
  
  <pre><code>    [{"field1": "b", "field2":"x"},
       {"field1" : "z", "field2":"a"}]
  </code></pre>
  
  <p>i have make this class:</p>
  
  <pre><code>public class OrderComparator  implements Comparator {
      String field;
  
      public OrderComparator (String field){
          this.field = field;
      }
  
      @Override
      public int compare(Object obj1, Object obj2) {
            LinkedHashMap&lt;String, Object&gt; a = (LinkedHashMap&lt;String, Object&gt;) obj1;
            LinkedHashMap&lt;String, Object&gt; b = (LinkedHashMap&lt;String, Object&gt;) obj2;
  
            return a.get(this.field).toString().compareTo(b.get(this.field).toString());
      }   
  }
  </code></pre>
  
  <p>and :</p>
  
  <pre><code>Collections.sort(list, new OrderComparator(sortColumn));
  </code></pre>
  
  <p>is correct? thanks to all!!!</p>