public final class MapUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <K,V extends java.lang.Comparable<V>> |
sortByValue(java.util.Map<K,V> map)
Sorts the provided Map by the value instead of by key like TreeMap does.
|
static <K extends java.lang.Comparable<K>,V extends java.lang.Comparable<V>> |
sortByValueAndKey(java.util.Map<K,V> map)
Sorts the provided Map by the value and then by key instead of by key like TreeMap does.
|
public static <K,V extends java.lang.Comparable<V>> java.util.List<java.util.Map.Entry<K,V>> sortByValue(java.util.Map<K,V> map)
K - the key-type of the Map that should be sortedV - the value-type of the Map that should be sorted. Needs to derive from Comparablemap - A map with some elements which should be sorted by Value.public static <K extends java.lang.Comparable<K>,V extends java.lang.Comparable<V>> java.util.List<java.util.Map.Entry<K,V>> sortByValueAndKey(java.util.Map<K,V> map)
K - the key-type of the Map that should be sorted Needs to derive from ComparableV - the value-type of the Map that should be sorted. Needs to derive from Comparablemap - A map with some elements which should be sorted by Value first and then by Key.