Sorting HashMap
<p>I have an <code>ArrayList</code> of <code>HashMap</code>. Each <code>HashMap</code> contains many key-value-pairs. I want to sort the <code>ArrayList</code> by the value of the key <code>distance</code> in the <code>HashMap</code>.</p>

<pre><code>ArrayList&lt;HashMap&lt;String, String&gt;&gt; arrayListHashMap = 
    new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

{
    HashMap hashMap = new HashMap&lt;String, Object&gt;();
    hashMap.put("key", "A key");
    hashMap.put("value", "B value");
    hashMap.put("distance", 2536);

    arrayListHashMap.add(hashMap);
}

{
    HashMap hashMap = new HashMap&lt;String, String&gt;();
    hashMap.put("key", "B key");
    hashMap.put("value", "A value");
    hashMap.put("distance", 2539);
    arrayListHashMap.add(hashMap);
}
</code></pre>
