velosurf.util
Class HashMultiMap

java.lang.Object
  |
  +--velosurf.util.HashMultiMap
All Implemented Interfaces:
MultiMap

public class HashMultiMap
extends java.lang.Object
implements MultiMap

A MultiMap is a Map allowing multiple occurrences of keys.

Version:
$ProjectVersion: 0.207 $
Author:
Mark Richters
See Also:
Map

Field Summary
private  java.util.Map fMap
          inner map
private  int fSizeAll
          total number of values
 
Constructor Summary
HashMultiMap()
          builds a new HashMultiMap
 
Method Summary
 void clear()
          Removes all mappings from this map (optional operation).
 boolean containsKey(java.lang.Object key)
          Returns true if this multimap contains a mapping for the specified key.
 boolean containsValue(java.lang.Object value)
          Returns true if this multimap maps one or more keys to the specified value.
 boolean equals(java.lang.Object o)
          Compares the specified object with this multimap for equality.
 java.util.List get(java.lang.Object key)
          Returns a list of values to which this multimap maps the specified key.
 int hashCode()
          Returns the hash code value for this multimap.
 boolean isEmpty()
          Returns true if this multimap contains no mappings.
 java.util.Set keySet()
          Returns a set view of the keys contained in this multimap.
 void put(java.lang.Object key, java.lang.Object value)
          Adds the specified value with the specified key to this multimap.
 void putAll(MultiMap t)
          Copies all entries from the specified multimap to this multimap.
 void remove(java.lang.Object key)
          Removes all mappings for this key from this multimap if present.
 void remove(java.lang.Object key, java.lang.Object value)
          Removes the specified key/value mapping from this multimap if present.
 int size()
          Returns the number of values in this multimap.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

fMap

private java.util.Map fMap
inner map

fSizeAll

private transient int fSizeAll
total number of values
Constructor Detail

HashMultiMap

public HashMultiMap()
builds a new HashMultiMap
Method Detail

size

public int size()
Returns the number of values in this multimap.
Specified by:
size in interface MultiMap
Returns:
totla number of values

isEmpty

public boolean isEmpty()
Returns true if this multimap contains no mappings.
Specified by:
isEmpty in interface MultiMap
Returns:
empty status

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if this multimap contains a mapping for the specified key.
Specified by:
containsKey in interface MultiMap
Parameters:
key -  

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this multimap maps one or more keys to the specified value.
Specified by:
containsValue in interface MultiMap

get

public java.util.List get(java.lang.Object key)
Returns a list of values to which this multimap maps the specified key.
Specified by:
get in interface MultiMap
Returns:
the list of values to which this map maps the specified key, the list may be empty if the multimap contains no mapping for this key.

put

public void put(java.lang.Object key,
                java.lang.Object value)
Adds the specified value with the specified key to this multimap.
Specified by:
put in interface MultiMap

putAll

public void putAll(MultiMap t)
Copies all entries from the specified multimap to this multimap.
Specified by:
putAll in interface MultiMap

remove

public void remove(java.lang.Object key)
Removes all mappings for this key from this multimap if present.
Specified by:
remove in interface MultiMap

remove

public void remove(java.lang.Object key,
                   java.lang.Object value)
Removes the specified key/value mapping from this multimap if present.
Specified by:
remove in interface MultiMap

clear

public void clear()
Removes all mappings from this map (optional operation).
Specified by:
clear in interface MultiMap

keySet

public java.util.Set keySet()
Returns a set view of the keys contained in this multimap.
Specified by:
keySet in interface MultiMap

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this multimap for equality.
Specified by:
equals in interface MultiMap
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code value for this multimap.
Specified by:
hashCode in interface MultiMap
Overrides:
hashCode in class java.lang.Object


ooOoo