This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
You should use a TreeMap for sorting purpose. By default it is sorted by natural-order (i.e. using the compareTo method). You could also add a Comparator to have a better control over your sorting. Checkout the TreeMap API. Example:
You could also pass your existing HashMap as an argument.