fulmine.util.collection
Class MapList<KEY,LIST_TYPE>
java.lang.Object
fulmine.util.collection.MapList<KEY,LIST_TYPE>
- Type Parameters:
KEY
- the type for the map keysLIST_TYPE
- the type for the list entries for each key
- All Implemented Interfaces:
- Map<KEY,List<LIST_TYPE>>
public final class MapList<KEY,LIST_TYPE>
- extends Object
A Map
that has List
values. The lists are auto-created via
the get(Object)
method with a size of 1.
This is not thread safe.
- Author:
- Ramon Servadei
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
DEFAULT_INITIAL_CAPACITY
protected static final int DEFAULT_INITIAL_CAPACITY
- The default initial capacity - MUST be a power of two.
- See Also:
- Constant Field Values
DEFAULT_LOAD_FACTOR
protected static final float DEFAULT_LOAD_FACTOR
- The load factor used when none specified in constructor.
- See Also:
- Constant Field Values
delegate
protected final Map<KEY,COLLECTION_TYPE> delegate
MapList
public MapList()
MapList
public MapList(int size)
MapList
public MapList(int size,
float loadFactor)
createCollection
protected List<LIST_TYPE> createCollection()
- Overridden in sub-classes to provide the
Collection
type to store
per key in the map.
- Returns:
- a created instance of the collection type for a new key added to
the map
clear
public void clear()
- Specified by:
clear
in interface Map<KEY,COLLECTION_TYPE>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map<KEY,COLLECTION_TYPE>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interface Map<KEY,COLLECTION_TYPE>
entrySet
public Set<Map.Entry<KEY,COLLECTION_TYPE>> entrySet()
- Specified by:
entrySet
in interface Map<KEY,COLLECTION_TYPE>
equals
public boolean equals(Object o)
- Specified by:
equals
in interface Map<KEY,COLLECTION_TYPE>
- Overrides:
equals
in class Object
get
public COLLECTION_TYPE get(Object key)
- Get the
Collection
type keyed against the object, creating the
collection type if needed.
- Specified by:
get
in interface Map<KEY,COLLECTION_TYPE>
- See Also:
Map.get(Object)
hashCode
public int hashCode()
- Specified by:
hashCode
in interface Map<KEY,COLLECTION_TYPE>
- Overrides:
hashCode
in class Object
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Map<KEY,COLLECTION_TYPE>
keySet
public Set<KEY> keySet()
- Specified by:
keySet
in interface Map<KEY,COLLECTION_TYPE>
put
public COLLECTION_TYPE put(KEY key,
COLLECTION_TYPE value)
- Specified by:
put
in interface Map<KEY,COLLECTION_TYPE>
putAll
public void putAll(Map<? extends KEY,? extends COLLECTION_TYPE> t)
- Specified by:
putAll
in interface Map<KEY,COLLECTION_TYPE>
remove
public COLLECTION_TYPE remove(Object key)
- Specified by:
remove
in interface Map<KEY,COLLECTION_TYPE>
size
public int size()
- Specified by:
size
in interface Map<KEY,COLLECTION_TYPE>
values
public Collection<COLLECTION_TYPE> values()
- Specified by:
values
in interface Map<KEY,COLLECTION_TYPE>
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2007-2009. All Rights Reserved.