|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javautils.maps.AbstractTypedMap | +--javautils.maps.ObjectToListMap
Map from objects to non-null List
-objects. This class is
designed mainly for convenience.
Field Summary |
Fields inherited from class javautils.maps.AbstractTypedMap |
map |
Constructor Summary | |
ObjectToListMap()
A new map based on HashMap . |
|
ObjectToListMap(java.util.Collection keys)
A new map that maps the given keys to new ArrayList -instances. |
|
ObjectToListMap(java.util.Map map)
A new Object->List map using the given map. |
|
ObjectToListMap(java.util.Map aMap,
java.util.Collection keys,
java.lang.Class listType)
A new Object->List map using the given map, with the
specifified keys mapped to new instances of the specified list type.
|
Method Summary | |
java.util.List |
ensuredGet(java.lang.Object key)
return ensuredGet(key, ArrayList.class); |
java.util.List |
ensuredGet(java.lang.Object key,
java.lang.Class listType)
Returns the value associated with the specified key or associates a new instance of the specified List -class with the key and
returns the new instance. |
java.util.List |
get(java.lang.Object key)
The value associated with the specified key or null. |
java.util.List |
getOrEmptyUnmodifiableList(java.lang.Object key)
The value associated with the key or an empty, unmodifiable list if no value is associated with the key. |
void |
put(java.lang.Object key,
java.util.List value)
Associates the key with the specified value. |
void |
transformListsToUnmodifiableLists()
Makes the lists in the map unmodifiable. |
protected boolean |
valuePredicate(java.lang.Object value)
True iff the value is a non null List -object. |
Methods inherited from class javautils.maps.AbstractTypedMap |
clear, clone, containsKey, isEmpty, keyIterator, keySet, remove, size, toString, unmodifiableMap, valueIterator |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ObjectToListMap()
A new map based on HashMap
.
public ObjectToListMap(java.util.Collection keys)
A new map that maps the given keys to new ArrayList
-instances.
public ObjectToListMap(java.util.Map aMap, java.util.Collection keys, java.lang.Class listType)
A new Object->List
map using the given map, with the
specifified keys mapped to new instances of the specified list type.
The given map must not contain any null values not values that are
not instances of List
. The given map should also never
be modified except by using the services of this class.
public ObjectToListMap(java.util.Map map)
A new Object->List
map using the given map. The given
map must not contain any null values not values that are not
instances of List
. The given map should also never be
modified except by using the services of this class.
Method Detail |
protected boolean valuePredicate(java.lang.Object value)
True iff the value is a non null
List
-object.
valuePredicate
in class AbstractTypedMap
public void put(java.lang.Object key, java.util.List value)
Associates the key with the specified value.
public java.util.List get(java.lang.Object key)
The value associated with the specified key or null.
public java.util.List ensuredGet(java.lang.Object key)
return ensuredGet(key, ArrayList.class);
public java.util.List ensuredGet(java.lang.Object key, java.lang.Class listType)
Returns the value associated with the specified key or associates
a new instance of the specified List
-class with the key and
returns the new instance.
public java.util.List getOrEmptyUnmodifiableList(java.lang.Object key)
The value associated with the key or an empty, unmodifiable list if no value is associated with the key.
public void transformListsToUnmodifiableLists()
Makes the lists in the map unmodifiable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |