jgnash.util
Class MultiHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,java.lang.Object>
          extended by jgnash.util.MultiHashMap<K,V>
Type Parameters:
K - Key class
V - Object class
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.lang.Object>

public class MultiHashMap<K,V>
extends java.util.HashMap<K,java.lang.Object>

A HashMap that allows multiple values for the same key. If multiple values exist for a given key, the values are treated as a FILO buffer.

This class is thread-safe

Version:
$Id$
Author:
Craig Cavanaugh
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>
 
Field Summary
private  java.util.concurrent.locks.ReentrantReadWriteLock lock
           
private static long serialVersionUID
           
 
Constructor Summary
MultiHashMap()
           
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          By default the last value in, is the first value out
 java.lang.Object put(K key, java.lang.Object value)
           
 java.lang.Object remove(K key, V value)
          Removes a specific value
 java.lang.Object remove(java.lang.Object key)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, 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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

lock

private java.util.concurrent.locks.ReentrantReadWriteLock lock
Constructor Detail

MultiHashMap

public MultiHashMap()
Method Detail

put

public java.lang.Object put(K key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<K,java.lang.Object>
Overrides:
put in class java.util.HashMap<K,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)
By default the last value in, is the first value out

Specified by:
get in interface java.util.Map<K,java.lang.Object>
Overrides:
get in class java.util.HashMap<K,java.lang.Object>

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<K,java.lang.Object>
Overrides:
remove in class java.util.HashMap<K,java.lang.Object>

remove

public java.lang.Object remove(K key,
                               V value)
Removes a specific value

Parameters:
key - The key of the value to remove
value - The specific value to remove
Returns:
the remove value, null if it was not found in the map