Guava: construct a Multimap by inverting a Map
问题 why does Guava doesn't have the following factory call to create a MultiMap from a normal Map? public static <K,V> MultiMap<K,V> invertMap(Map<V,K> map); I have program-names mapped to an integer of how often they were called. I'd like to invert this, so that i can ultimately construct a TreeMap, sorted by call-count, which then are the keys leading to one or multiple program-names. 回答1: How about: public static <K,V> Multimap<K,V> invertMap(Map<V,K> map) { return Multimaps.invertFrom