com.neoworks.util
Class VectorMultiMap

java.lang.Object
  |
  +--com.neoworks.util.AbstractMultiMap
        |
        +--com.neoworks.util.VectorMultiMap
All Implemented Interfaces:
MultiMap

public class VectorMultiMap
extends AbstractMultiMap

This class implements the MultiMap interface backed with a Vector.

Version:
0.1
Author:
Stuart Farnan stuart@neoworks.com

Nested Class Summary
 
Nested classes inherited from class com.neoworks.util.MultiMap
MultiMap.Entry
 
Constructor Summary
VectorMultiMap()
          Default constructor, creates an empty VectorMultiMap.
VectorMultiMap(MultiMap multimap)
          Constructor, creates a VectorMultiMap with the same mapping as the given multimap.
 
Method Summary
 java.util.Set entrySet()
          Returns a set view of the mappings contained in this multimap.
 java.util.List getValueList(java.lang.Object key)
          Get the values for a key as a list
 java.util.Set put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in this map (optional operation).
 
Methods inherited from class com.neoworks.util.AbstractMultiMap
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keys, putAll, remove, remove, size, toString, uniqueKeys, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VectorMultiMap

public VectorMultiMap()
Default constructor, creates an empty VectorMultiMap.


VectorMultiMap

public VectorMultiMap(MultiMap multimap)
Constructor, creates a VectorMultiMap with the same mapping as the given multimap.

Parameters:
multimap - The multimap whose mappings we want to copy.
Method Detail

put

public java.util.Set put(java.lang.Object key,
                         java.lang.Object value)
Associates the specified value with the specified key in this map (optional operation). If the multimap previously contained a mapping for this key, the old value is not lost.

This implementation always throws an UnsupportedOperationException.

Specified by:
put in interface MultiMap
Overrides:
put in class AbstractMultiMap
Parameters:
key - Key with which the specified value is to be associated.
value - Value to be associated with the specified key.
Returns:
Set of values associated with the specified key.

getValueList

public java.util.List getValueList(java.lang.Object key)
Get the values for a key as a list

Parameters:
key - The key
Returns:
A List of the values

entrySet

public java.util.Set entrySet()
Returns a set view of the mappings contained in this multimap. Each element in this set is a MultiMap.Entry. The set is backed by the map, so changes to the multimap are reflected in the set, and vice-versa. (If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined.) The set supports element removal, which removes the corresponding entry from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Specified by:
entrySet in interface MultiMap
Specified by:
entrySet in class AbstractMultiMap
Returns:
A set view of the mappings contained in this multimap.