qflib 0.99

de.qfs.lib.util
Class ListBasedMultiMap

java.lang.Object
  extended byde.qfs.lib.util.MultiMap
      extended byde.qfs.lib.util.ListBasedMultiMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ListBasedMultiMap
extends MultiMap

This is a special MultiMap with a list-based value set. It retains the order in which values for a key are added. The result of getAll() is derived from ArrayList.

Author:
Gregor Schmid
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class de.qfs.lib.util.MultiMap
MultiMap.MapEntry, MultiMap.MapIterator, MultiMap.ValueSet
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class de.qfs.lib.util.MultiMap
ENTRIES, entrySet, KEYS, keySet, modCounter, valCount, values, VALUES
 
Constructor Summary
ListBasedMultiMap()
          Create a new ListBasedMultiMap.
ListBasedMultiMap(int initialCapacity)
          Create a new ListBasedMultiMap.
ListBasedMultiMap(java.util.Map map)
          Create a new ListBasedMultiMap and initialize it with all the mappings from the passed map.
 
Method Summary
protected  java.util.Set copyResultSet(MultiMap.ValueSet result)
          Create a new result set for the getAll method.
protected  java.util.Set createResultSet(java.lang.Object result)
          Create a new result set for a single element result of the getAll method.
 MultiMap.ValueSet createValueSet()
          Overidden to return list based set.
 
Methods inherited from class de.qfs.lib.util.MultiMap
_remove, clear, clone, cloneDelegate, contains, containsKey, containsValue, entrySet, equals, get, getAll, getCount, hashCode, isEmpty, keySet, mapsToMany, put, putAll, remove, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBasedMultiMap

public ListBasedMultiMap()
Create a new ListBasedMultiMap.


ListBasedMultiMap

public ListBasedMultiMap(int initialCapacity)
Create a new ListBasedMultiMap.

Parameters:
initialCapacity - The initial capacity of the ListBasedMultiMap.

ListBasedMultiMap

public ListBasedMultiMap(java.util.Map map)
Create a new ListBasedMultiMap and initialize it with all the mappings from the passed map.

Parameters:
map - The map that initializes this ListBasedMultiMap.
Method Detail

createValueSet

public MultiMap.ValueSet createValueSet()
Overidden to return list based set.

Overrides:
createValueSet in class MultiMap
Returns:
A new ValueSet.

copyResultSet

protected java.util.Set copyResultSet(MultiMap.ValueSet result)
Create a new result set for the getAll method. Can be overridden to provide a matching implementation.

Overrides:
copyResultSet in class MultiMap
Parameters:
result - The internal result set that should not be exposed.
Returns:
A copy of the result set.

createResultSet

protected java.util.Set createResultSet(java.lang.Object result)
Create a new result set for a single element result of the getAll method. Can be overridden to provide a matching implementation.

Overrides:
createResultSet in class MultiMap
Parameters:
result - The result element.
Returns:
A new result set.

qflib 0.99