org.planx.util
Class MultiMap<K,V>

java.lang.Object
  extended by org.planx.util.MultiMap<K,V>

public class MultiMap<K,V>
extends Object

A set of mappings from one key to multiple values.

Author:
Thomas Ambus

Constructor Summary
MultiMap()
           
 
Method Summary
 void clear()
          Removes all mappings from this MultiMap.
 void clearModified()
           
 boolean containsKey(Object key)
           
static
<E,F> SizeStreamer<MultiMap<E,F>>
getStreamer(SizeStreamer<E> keyStreamer, SizeStreamer<F> valueStreamer)
          Returns a streamer capable of writing and reading an MultiMap.
 boolean isModified()
           
 Set<K> keySet()
          Returns the keys of this MultiMap.
 void put(K key, V value)
          Inserts a mapping.
 boolean remove(Object key, Object value)
          Removes a mapping.
 boolean removeKey(Object key)
          Removes all mappings with the specified key.
 boolean removeValue(Object value)
          Removes all occurrences of the specified value.
 boolean retainValues(Collection<V> values)
          Removes all values not present in the specified set.
 int size()
           
 String toString()
           
 Set<V> values(Object key)
          Returns a set containing the values associated with the specified key.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiMap

public MultiMap()
Method Detail

put

public void put(K key,
                V value)
Inserts a mapping.


containsKey

public boolean containsKey(Object key)

remove

public boolean remove(Object key,
                      Object value)
Removes a mapping.


removeKey

public boolean removeKey(Object key)
Removes all mappings with the specified key.


removeValue

public boolean removeValue(Object value)
Removes all occurrences of the specified value.


retainValues

public boolean retainValues(Collection<V> values)
Removes all values not present in the specified set.


keySet

public Set<K> keySet()
Returns the keys of this MultiMap.


values

public Set<V> values(Object key)
Returns a set containing the values associated with the specified key.


clear

public void clear()
Removes all mappings from this MultiMap.


size

public int size()

isModified

public boolean isModified()

clearModified

public void clearModified()

toString

public String toString()
Overrides:
toString in class Object

getStreamer

public static <E,F> SizeStreamer<MultiMap<E,F>> getStreamer(SizeStreamer<E> keyStreamer,
                                                            SizeStreamer<F> valueStreamer)
Returns a streamer capable of writing and reading an MultiMap. The toStream method always returns null.



Copyright © 2004-2005 Plan-X. All Rights Reserved.