public final class EconomicMapUtil extends Object
EconomicMap
.Modifier and Type | Method and Description |
---|---|
static <K,V> boolean |
equals(UnmodifiableEconomicMap<K,V> lhs,
UnmodifiableEconomicMap<K,V> rhs)
Compares maps for equality.
|
static <K,V> int |
hashCode(UnmodifiableEconomicMap<K,V> map)
Computes an order-independent hash code for an
EconomicMap . |
static <K,V> EconomicSet<K> |
keySet(EconomicMap<K,V> map)
Returns an
EconomicSet of the keys contained in a map. |
static <K,V> Comparator<UnmodifiableEconomicMap<K,V>> |
lexicographicalComparator(Comparator<K> keyComparator,
Comparator<V> valueComparator)
Creates a lexicographical map comparator using the provided key and value comparators.
|
public static <K,V> boolean equals(UnmodifiableEconomicMap<K,V> lhs, UnmodifiableEconomicMap<K,V> rhs)
equivalence strategy
, their keys are equal with
respect to the strategy and the values are equal as determined by the
equals
method.lhs
- the first map to be comparedrhs
- the second map to be comparedtrue
iff the maps are equalpublic static <K,V> int hashCode(UnmodifiableEconomicMap<K,V> map)
EconomicMap
.map
- the input map or null
public static <K,V> EconomicSet<K> keySet(EconomicMap<K,V> map)
EconomicSet
of the keys contained in a map.map
- the input mapEconomicSet
of the keys contained in a mappublic static <K,V> Comparator<UnmodifiableEconomicMap<K,V>> lexicographicalComparator(Comparator<K> keyComparator, Comparator<V> valueComparator)
{key1, value1, key2, value2,
...}
. The comparison starts by comparing their key1
and if they are equal, it goes
on to compare value1
, then key2
, value2
and so on. If one of the maps
is shorter, the comparators are called with null
values in place of the missing
keys/values.keyComparator
- a comparator to compare keysvalueComparator
- a comparator to compare values