public final class MapExtensions
extends java.lang.Object
| Constructor and Description |
|---|
MapExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> K |
getKeyFromValue(@NonNull java.util.Map<K,V> map,
V value)
Returns the first founded key from the given value or null if nothing is found.
|
static <K,V> java.util.Collection<K> |
getKeysFromValue(@NonNull java.util.Map<K,V> map,
V value)
Returns a Collection from all founded keys from the given value or null if nothing found.
|
static <K,V extends java.lang.Comparable<? super V>> |
sortByValue(@NonNull java.util.Map<K,V> map,
boolean reversed)
Sort the given Map by its values and returns a sorted list by the values of the given Map
|
static <K,V extends java.lang.Comparable<? super V>> |
sortByValue(@NonNull java.util.Map<K,V> map,
@NonNull java.util.Comparator<? super V> comparator)
Sort the given Map by its values and returns a sorted list by the values of the given Map
|
static <K,V extends java.lang.Comparable<? super V>> |
sortByValueAsList(@NonNull java.util.Map<K,V> map,
boolean reversed)
Sort the given Map by its values and returns a sorted list by the values of the given Map
|
static <K,V extends java.lang.Comparable<? super V>> |
sortByValueAsList(@NonNull java.util.Map<K,V> map,
@NonNull java.util.Comparator<? super V> comparator)
Sort the given Map by its values and returns a sorted list by the values of the given Map
|
static <T> java.util.Map<T,T> |
toGenericMap(T[][] twoDimArray)
Converts a two dimensional Array to a Map.
|
static java.util.Map<java.lang.String,java.lang.String> |
toMap(java.lang.String[][] twoDimArray)
Converts a two dimensional String Array to a Map.
|
public static <K,V extends java.lang.Comparable<? super V>> java.util.List<java.util.Map.Entry<K,V>> sortByValueAsList(@NonNull
@NonNull java.util.Map<K,V> map,
boolean reversed)
K - the generic type of the keyV - the generic type of the valuemap - The Map to sortreversed - the flag if the result should be in reversed orderpublic static <K,V extends java.lang.Comparable<? super V>> java.util.List<java.util.Map.Entry<K,V>> sortByValueAsList(@NonNull
@NonNull java.util.Map<K,V> map,
@NonNull
@NonNull java.util.Comparator<? super V> comparator)
K - the generic type of the keyV - the generic type of the valuemap - The Map to sortcomparator - the comparator to sortpublic static <K,V extends java.lang.Comparable<? super V>> java.util.Map<K,V> sortByValue(@NonNull
@NonNull java.util.Map<K,V> map,
boolean reversed)
K - the generic type of the keyV - the generic type of the valuemap - the Map to sortreversed - the flag if the result should be in reversed orderpublic static <K,V extends java.lang.Comparable<? super V>> java.util.Map<K,V> sortByValue(@NonNull
@NonNull java.util.Map<K,V> map,
@NonNull
@NonNull java.util.Comparator<? super V> comparator)
K - the generic type of the keyV - the generic type of the valuemap - the Map to sortcomparator - the comparator to sortpublic static <K,V> K getKeyFromValue(@NonNull
@NonNull java.util.Map<K,V> map,
V value)
K - the generic type of the keyV - the generic type of the valuemap - The Map.value - The value.public static <K,V> java.util.Collection<K> getKeysFromValue(@NonNull
@NonNull java.util.Map<K,V> map,
V value)
K - the generic type of the keyV - the generic type of the valuemap - The Map.value - The value.public static <T> java.util.Map<T,T> toGenericMap(@NonNull
T[][] twoDimArray)
T - the generic typetwoDimArray - The two dimensional Array.public static java.util.Map<java.lang.String,java.lang.String> toMap(java.lang.String[][] twoDimArray)
twoDimArray - The two dimensional String Array.