I would like to order a map(A,Double) based on the values.
Function<Map.Entry<A, Double>, Double> getSimFunction = new Function<Map.Entry<A, Double>, Double>() {
public Double apply(Map.Entry<A, Double> entry) {
return entry.getValue();
}
};
final Ordering<Map.Entry<A, Double>> entryOrdering = Ordering.natural().onResultOf(getSimFunction);
ImmutableSortedMap.orderedBy(entryOrdering).putAll(....).build();
How can I create a new sortedMap based on the ordering results or a sortedset based on the map.keyset()?