HashMap<String,SomeClass> someHashMap= ...;
Collections.sort(someHashMap, new Comparator<SomeClass>() {
public int compare(SomeClass o1, SomeClass o2) {
//return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
}
});