public class Maps extends Object
| Modifier and Type | Method and Description |
|---|---|
static <K,E> void |
addToList(Map<K,List<E>> map,
K k,
E e)
Adds the given element to the list that is stored under the
given key.
|
static <K,V> void |
fillValues(Map<K,V> map,
Iterable<? extends V> values)
Fill the given map sequentially with the values from the given
sequence.
|
static <T> Map<Integer,T> |
fromElements(T... elements)
Creates a map that maps consecutive integer values to the
corresponding elements in the given array.
|
static <T> Map<Integer,T> |
fromIterable(Iterable<? extends T> iterable)
Creates a map that maps consecutive integer values to the elements
in the given sequence, in the order in which they appear.
|
static <K,V> Map<K,V> |
fromIterables(Iterable<? extends K> iterable0,
Iterable<? extends V> iterable1)
Creates a map that maps the elements of the first sequence to
the corresponding elements in the second sequence.
|
static <K> Integer |
getCount(Map<K,Integer> map,
K k)
Returns the value that is stored for the given key in the given map.
|
static <K> void |
incrementCount(Map<K,Integer> map,
K k)
Increments the value that is stored for the given key in the given
map by one, or sets it to 1 if there was no value stored for the
given key.
|
static <K,V> Map<K,V> |
unmodifiableCopy(Map<? extends K,? extends V> map)
Creates an unmodifiable copy of the given map
|
public static <K> void incrementCount(Map<K,Integer> map, K k)
K - The key typemap - The mapk - The keypublic static <K> Integer getCount(Map<K,Integer> map, K k)
K - The key typemap - The mapk - The keypublic static <K,E> void addToList(Map<K,List<E>> map, K k, E e)
K - The key typeE - The element typemap - The mapk - The keye - The elementpublic static <K,V> void fillValues(Map<K,V> map, Iterable<? extends V> values)
K - The key typeV - The value typemap - The map to fillvalues - The values@SafeVarargs public static <T> Map<Integer,T> fromElements(T... elements)
T - The value typeelements - The elementspublic static <T> Map<Integer,T> fromIterable(Iterable<? extends T> iterable)
T - The value typeiterable - The sequencepublic static <K,V> Map<K,V> fromIterables(Iterable<? extends K> iterable0, Iterable<? extends V> iterable1)
K - The key typeV - The value typeiterable0 - The first sequenceiterable1 - The second sequenceCopyright © 2015. All rights reserved.