public class MoreMaps extends Object
Modifier and Type | Method and Description |
---|---|
static <K extends Comparable<?>,V> |
convertMultimapToMapOfLists(com.google.common.collect.ImmutableMultimap<K,V> multimap) |
static <K,V> com.google.common.collect.ImmutableMap<K,V> |
filterValues(Map<K,V> unfiltered,
com.google.common.base.Predicate<? super V> valuePredicate)
Version of
Maps.filterValues(Map, Predicate) that collects the results in an immutable
map. |
static <K,V> com.google.common.collect.ImmutableMap<K,V> |
merge(Map<K,V> first,
Map<K,V> second) |
static <K,V> com.google.common.collect.ImmutableSortedMap<K,V> |
mergeSorted(Map<K,V> first,
Map<K,V> second) |
static <K,V> Map<K,V> |
putCheckEquals(Map<K,V> map,
K key,
V value) |
static <K,V> Map<K,V> |
putIfAbsentCheckEquals(ConcurrentMap<K,V> map,
K key,
V value)
Inserts the given value if nothing was already set for the key.
|
static <K1,K2,V> com.google.common.collect.ImmutableMap<K2,V> |
transformKeys(Map<K1,V> map,
java.util.function.Function<? super K1,K2> transformer)
Transform a map to another immutable map by changing keys and keeping values
|
static <K1,K2 extends Comparable<?>,V> |
transformKeysAndSort(Map<K1,V> map,
java.util.function.Function<? super K1,K2> transformer) |
public static <K,V> Map<K,V> putIfAbsentCheckEquals(ConcurrentMap<K,V> map, K key, @Nullable V value)
public static <K1,K2,V> com.google.common.collect.ImmutableMap<K2,V> transformKeys(Map<K1,V> map, java.util.function.Function<? super K1,K2> transformer)
map
- Source map to transformtransformer
- Function to apply to source map key to infer resulting map keypublic static <K1,K2 extends Comparable<?>,V> com.google.common.collect.ImmutableSortedMap<K2,V> transformKeysAndSort(Map<K1,V> map, java.util.function.Function<? super K1,K2> transformer)
public static <K,V> com.google.common.collect.ImmutableMap<K,V> merge(Map<K,V> first, Map<K,V> second)
public static <K,V> com.google.common.collect.ImmutableSortedMap<K,V> mergeSorted(Map<K,V> first, Map<K,V> second)
public static <K extends Comparable<?>,V> com.google.common.collect.ImmutableSortedMap<K,com.google.common.collect.ImmutableList<V>> convertMultimapToMapOfLists(com.google.common.collect.ImmutableMultimap<K,V> multimap)
public static <K,V> com.google.common.collect.ImmutableMap<K,V> filterValues(Map<K,V> unfiltered, com.google.common.base.Predicate<? super V> valuePredicate)
Maps.filterValues(Map, Predicate)
that collects the results in an immutable
map.Maps.filterValues(Map, Predicate)