com.mckoi.util
Class HashMapList

java.lang.Object
  extended by com.mckoi.util.HashMapList

public class HashMapList
extends java.lang.Object

A HashMap that maps from a source to a list of items for that source. This is useful as a searching mechanism where the list of searched items are catagorised in the mapped list.

Author:
Tobias Downer

Constructor Summary
HashMapList()
          Constructs the map.
 
Method Summary
 java.util.List clear(java.lang.Object key)
          Clears the all the values for the given key.
 boolean containsKey(java.lang.Object key)
          Returns true if the map contains the key.
 java.util.List get(java.lang.Object key)
          Returns the list of values that are in the map under this key.
 java.util.Set keySet()
          The Set of all keys.
 void put(java.lang.Object key, java.lang.Object val)
          Puts a value into the map list.
 boolean remove(java.lang.Object key, java.lang.Object val)
          Removes the given value from the list with the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashMapList

public HashMapList()
Constructs the map.

Method Detail

put

public void put(java.lang.Object key,
                java.lang.Object val)
Puts a value into the map list.


get

public java.util.List get(java.lang.Object key)
Returns the list of values that are in the map under this key. Returns an empty list if no key map found.


remove

public boolean remove(java.lang.Object key,
                      java.lang.Object val)
Removes the given value from the list with the given key.


clear

public java.util.List clear(java.lang.Object key)
Clears the all the values for the given key. Returns the List of items that were stored under this key.


keySet

public java.util.Set keySet()
The Set of all keys.


containsKey

public boolean containsKey(java.lang.Object key)
Returns true if the map contains the key.