org.apache.wicket.util.collections
Class MultiMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,java.util.List<V>>
          extended by org.apache.wicket.util.collections.MultiMap<K,V>
Type Parameters:
K -
V -
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.util.List<V>>

public class MultiMap<K,V>
extends java.util.HashMap<K,java.util.List<V>>

A simple multimap

Author:
igor
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
MultiMap()
          Constructor
MultiMap(int initialCapacity)
          Constructor
MultiMap(int initialCapacity, float loadFactor)
          Constructor
MultiMap(java.util.Map<? extends K,? extends java.util.List<V>> m)
          Constructor
 
Method Summary
 void addValue(K key, V value)
          Adds value to the specified key
 V getFirstValue(K key)
          Gets the first value in the value list
 void removeValue(K key, V value)
          Removes value from the specified key
 void replaceValues(K key, V value)
          Replaces all existing values with the specified value.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MultiMap

public MultiMap()
Constructor

See Also:
HashMap.HashMap()

MultiMap

public MultiMap(int initialCapacity,
                float loadFactor)
Constructor

Parameters:
initialCapacity -
loadFactor -
See Also:
HashMap.HashMap(int, float)

MultiMap

public MultiMap(int initialCapacity)
Constructor

Parameters:
initialCapacity -
See Also:
HashMap.HashMap(int)

MultiMap

public MultiMap(java.util.Map<? extends K,? extends java.util.List<V>> m)
Constructor

Parameters:
m -
See Also:
HashMap.HashMap(Map)
Method Detail

addValue

public void addValue(K key,
                     V value)
Adds value to the specified key

Parameters:
key -
value -

removeValue

public void removeValue(K key,
                        V value)
Removes value from the specified key

Parameters:
key -
value -

replaceValues

public void replaceValues(K key,
                          V value)
Replaces all existing values with the specified value. If no values exist for the key the value will be added.

Parameters:
key -
value -

getFirstValue

public V getFirstValue(K key)
Gets the first value in the value list

Parameters:
key -
Returns:
first value


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.