public final class MapExtensions extends Object
| Constructor and Description |
|---|
MapExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> K |
getKeyFromValue(@NonNull Map<K,V> map,
V value)
Returns the first founded key from the given value or null if nothing is found.
|
static <K,V> Collection<K> |
getKeysFromValue(@NonNull 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 Comparable<? super V>> |
sortByValue(@NonNull 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 Comparable<? super V>> |
sortByValue(@NonNull Map<K,V> map,
@NonNull 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 Comparable<? super V>> |
sortByValueAsList(@NonNull 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 Comparable<? super V>> |
sortByValueAsList(@NonNull Map<K,V> map,
@NonNull 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> Map<T,T> |
toGenericMap(T[][] twoDimArray)
Converts a two dimensional Array to a Map.
|
static Map<String,String> |
toMap(String[][] twoDimArray)
Converts a two dimensional String Array to a Map.
|
public static <K,V extends Comparable<? super V>> List<Map.Entry<K,V>> sortByValueAsList(@NonNull @NonNull 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 Comparable<? super V>> List<Map.Entry<K,V>> sortByValueAsList(@NonNull @NonNull Map<K,V> map, @NonNull @NonNull 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 Comparable<? super V>> Map<K,V> sortByValue(@NonNull @NonNull 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 Comparable<? super V>> Map<K,V> sortByValue(@NonNull @NonNull Map<K,V> map, @NonNull @NonNull 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 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> Collection<K> getKeysFromValue(@NonNull @NonNull 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> Map<T,T> toGenericMap(@NonNull T[][] twoDimArray)
T - the generic typetwoDimArray - The two dimensional Array.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.