public static <K> Map<K, Integer> rankMapOnIntegerValue(Map<K, Integer> inputMap) {
    Map<K, Integer> newMap = new TreeMap<K, Integer>(new IntegerValueComparator(inputMap));
    newMap.putAll(inputMap);

    Map<K, Integer> linkedMap = new LinkedHashMap<K, Integer>(newMap);
    return linkedMap;
  }
public static < K > Map < K , Integer > rankMapOnIntegerValue ( Map < K , Integer > inputMap ) { Map < K , Integer > newMap = new TreeMap < K , Integer > ( new IntegerValueComparator ( inputMap ) ) ; newMap . putAll ( inputMap ) ; Map < K , Integer > linkedMap = new LinkedHashMap < K , Integer > ( newMap ) ; return linkedMap ; }
Ranks a map based on integer values
@param inputMap Input
@return The ranked map