public final class Maps extends Object
| Modifier and Type | Method and Description |
|---|---|
static <K,V,T> T[] |
toArray(Map<K,V> map,
T[] entryArray)
Generates an array of entries from a map.
|
static <K,V,T> List<T> |
toList(Map<K,V> map,
Class<T> entryClass)
Generates a list of entries from a map.
|
static <K,V,T> Map<K,V> |
toMap(List<T> entryList)
Generates a map from a list of entries.
|
static <K,V,T> Map<K,V> |
toMap(T[] entryArray)
Generates a map from an array an entries.
|
public static <K,V,T> Map<K,V> toMap(List<T> entryList) throws IllegalArgumentException
key and value with a name
typically in the form of Key_ValueMapEntry, represented here as
T. The generated map must have same type K as the key within Key_ValueMapEntry. The same applies for V and
value within Key_ValueMapEntry.K - the type of the entry keyV - the type of the entry valueT - the map entry typeentryList - the list of entries constituting a map as represented in
the APIK and V representing the entry arrayIllegalArgumentException - if entryArray is not compatible
with Map<K, V> or if entryArray == nullpublic static <K,V,T> Map<K,V> toMap(T[] entryArray) throws IllegalArgumentException
key and value with a name
typically in the form of Key_ValueMapEntry, represented here as
T. The generated map must have same type K as the key within Key_ValueMapEntry. The same applies for V and
value within Key_ValueMapEntry. If
entryArray == null, an emtpy map is returned.K - the type of the entry keyV - the type of the entry valueT - the map entry typeentryArray - the array of entries constituting a map as represented in
the APIK and V representing the entry arrayIllegalArgumentException - if entryArray is not compatible
with Map<K, V>.public static <K,V,T> T[] toArray(Map<K,V> map, T[] entryArray)
key and value with a name
typically in the form of Key_ValueMapEntry, represented here as
T. The generated array can be used in objects where List<Key_ValueMapEntry> is taken as a value. The input map must have same type
K as the key within Key_ValueMapEntry. The same
applies for V and value within Key_ValueMapEntry.K - the type of the entry keyV - the type of the entry valueT - the map entry typemap - a map of type K and V representing the entry
arrayentryArray - the entry array that entries will be added intopublic static <K,V,T> List<T> toList(Map<K,V> map, Class<T> entryClass)
key and value with a name
typically in the form of Key_ValueMapEntry, represented here as
T. The generated array can be used in objects where List<Key_ValueMapEntry> is taken as a value. The input map must have same type
K as the key within Key_ValueMapEntry. The same
applies for V and value within Key_ValueMapEntry.K - the type of the entry keyV - the type of the entry valueT - the map entry typemap - a map of type K and V representing the entry
arrayentryClass - the entry class of type Copyright © 2015. All Rights Reserved.