|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.collections.MapUtil<K,V>
K
- V
- public class MapUtil<K,V>
Some Utility methods for creating maps in a nonverbose way .. Creationdate: Aug 22, 2007
Constructor Summary | |
---|---|
MapUtil()
|
Method Summary | ||
---|---|---|
static
|
fillAlternatingly(java.util.Map<V,V> map,
V... vals)
fills the passed map with the passed vals, alternatingly interpreted as key and value. |
|
static
|
getInt(java.util.Map<K,java.lang.Integer> map,
K key)
Convenience method to retrieve ints from a map. |
|
static
|
getInt(java.util.Map<K,java.lang.Integer> map,
K key,
int nullSubstitute)
Convenience method to retrieve ints from a map. |
|
java.util.Map<K,V> |
getMap()
creates a map with the keys/vals interpreted as keys[i]=vals[i]. |
|
static
|
getMap(V... vals)
creates a map with the vals interpreted as key, value, key, value, ... |
|
static
|
getSortedMap(V... vals)
creates a sorted map with the vals interpreted as key, value, key, value, ... |
|
MapUtil<K,V> |
setKeys(K... keys)
|
|
MapUtil<K,V> |
setValues(V... vals)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapUtil()
Method Detail |
---|
public static <V> java.util.Map<V,V> getMap(V... vals)
V
- vals
-
public static <V> java.util.SortedMap<V,V> getSortedMap(V... vals)
V
- vals
-
public static <V> void fillAlternatingly(java.util.Map<V,V> map, V... vals)
V
- map
- vals
- public MapUtil<K,V> setKeys(K... keys)
public MapUtil<K,V> setValues(V... vals)
public java.util.Map<K,V> getMap()
setKeys(Object[])
,
setValues(Object[])
public static <K> int getInt(java.util.Map<K,java.lang.Integer> map, K key)
K
- the key type of the map.map
- - a Map
with key type K and value type Integer
.key
- - the key.
public static <K> int getInt(java.util.Map<K,java.lang.Integer> map, K key, int nullSubstitute)
K
- the key type of the map.map
- - a Map
with key type K and value type Integer
.key
- - the key.nullSubstitute
- - the int-value for null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |