title: Sorting HashMap objects on their properties rather values
body: <p>This is not my real code I have just simulated in order to understand what to do next.
  <br><br>
  I have class Person with properties age, height weight.<br>
  Now In my class Group <br>
  I create two four objects </p>
  
  <pre><code>Person programmer, student, clerk, tech;
  </code></pre>
  
  <p>I have HashMap rollCall<br></p>
  
  <pre><code>Map&lt;Person, Integer&gt; rollCall = new HashMap&lt;Person, Integer&gt;();
  </code></pre>
  
  <p>to add all these using Person and number of Persons as type Integer<br></p>
  
  <pre><code>rollCall.put(programmer, 1);
  rollCall.put(clerk, 2);
  rollCall.put(student, 1);
  rollCall.put(tech, 3);
  </code></pre>
  
  <p>I have seen alot of people sorting HashMap using TreeMap on value I want to sort on a property of Person rather on value. I want to sort all these people on their age (i.e. programmer.getAge();). I am not sure if I will use comprator which works only on collection not map. 
  .
  Please help ...
  .</p>