public final class MapEntryUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MapEntryUtils.EnumMapBuilder<K extends Enum<K>,V> |
static class |
MapEntryUtils.GenericMapPopulator<K,V,M extends Map<K,V>> |
static class |
MapEntryUtils.MapBuilder<K,V> |
static class |
MapEntryUtils.NavigableMapBuilder<K,V> |
| Modifier and Type | Method and Description |
|---|---|
static <K extends Comparable<K>,V> |
byKeyEntryComparator() |
static <V> Supplier<NavigableMap<String,V>> |
caseInsensitiveMap() |
static <K,V,M extends Map<V,K>> |
flipMap(Map<? extends K,? extends V> map,
Supplier<? extends M> mapCreator,
boolean allowDuplicates)
Flips between keys and values of an input map
|
static boolean |
isEmpty(Map<?,?> m) |
static boolean |
isNotEmpty(Map<?,?> m) |
static <K,V,M extends Map<K,V>> |
mapValues(Function<? super V,? extends K> keyMapper,
Supplier<? extends M> mapCreator,
Collection<? extends V> values)
Creates a map out of a group of values
|
static <K,V,M extends Map<K,V>> |
mapValues(Function<? super V,? extends K> keyMapper,
Supplier<? extends M> mapCreator,
V... values) |
static int |
size(Map<?,?> m) |
static <T> BinaryOperator<T> |
throwingMerger() |
static <T,K,U> Collector<T,?,NavigableMap<K,U>> |
toSortedMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
Comparator<? super K> comparator) |
static <T,K,U> NavigableMap<K,U> |
toSortedMap(Iterable<? extends T> values,
Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper,
Comparator<? super K> comparator) |
public static <K extends Comparable<K>,V> Comparator<Map.Entry<K,V>> byKeyEntryComparator()
K - The Comparable key typeV - The associated entry valueComparator for Map.Entry-ies that compares the key valuespublic static int size(Map<?,?> m)
public static boolean isEmpty(Map<?,?> m)
public static boolean isNotEmpty(Map<?,?> m)
public static <V> Supplier<NavigableMap<String,V>> caseInsensitiveMap()
V - Type of mapped valueSupplier that returns a new NavigableMap whenever its get() method
is invokedpublic static <K,V,M extends Map<V,K>> M flipMap(Map<? extends K,? extends V> map, Supplier<? extends M> mapCreator, boolean allowDuplicates)
K - Original map key typeV - Original map value typeM - Flipped map typemap - The original map to flipmapCreator - The creator of the target mapallowDuplicates - Whether to ignore duplicates on flipIllegalArgumentException - if allowDuplicates is false and a duplicate value found in the
original map.@SafeVarargs public static <K,V,M extends Map<K,V>> M mapValues(Function<? super V,? extends K> keyMapper, Supplier<? extends M> mapCreator, V... values)
public static <K,V,M extends Map<K,V>> M mapValues(Function<? super V,? extends K> keyMapper, Supplier<? extends M> mapCreator, Collection<? extends V> values)
K - The key typeV - The value typeM - The result Map typekeyMapper - The Function that generates a key for a given value. If the returned key is
null then the value is not mappedmapCreator - The Supplier used to create/retrieve the result map - provided non-empty group of
valuesvalues - The values to be mappedMap - Note: no validation is made to ensure that 2 (or more)
values are not mapped to the same keypublic static <T,K,U> NavigableMap<K,U> toSortedMap(Iterable<? extends T> values, Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, Comparator<? super K> comparator)
public static <T,K,U> Collector<T,?,NavigableMap<K,U>> toSortedMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper, Comparator<? super K> comparator)
public static <T> BinaryOperator<T> throwingMerger()
Copyright © 2018–2024 The Apache Software Foundation. All rights reserved.