NetKernel APIs


com.ten60.netkernel.util
Class MultiMap

java.lang.Object
  extended bycom.ten60.netkernel.util.MultiMap

public final class MultiMap
extends Object

Implementation of a MultiMap- a map that can hold multiple values under each key.
Not Threadsafe- use external sychronization


Constructor Summary
MultiMap(int aInitialCapacity, int aMultiExpectancy)
          Creates a new instance of MultiMap
 
Method Summary
 void clear()
          remove all entriues from the map
 List get(Object aKey)
          retrieve all values for a given key
 Iterator keyIterator()
          return an iterator over all keys
 void put(Object aKey, Object aValue)
          put a value into the map with the key, no existing values will be displaced
 List remove(Object aKey)
          remove all values for the given key
 boolean remove(Object aKey, Object aValue)
          remove a given value index under a given key
 int size()
          return the number of entries in the map
 Iterator valueIterator()
          return an iterator over all values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiMap

public MultiMap(int aInitialCapacity,
                int aMultiExpectancy)
Creates a new instance of MultiMap

Parameters:
aInitialCapacity - the size of the hash map used at the first level
aMultiExpectancy - how many values we expect per key
Method Detail

put

public void put(Object aKey,
                Object aValue)
put a value into the map with the key, no existing values will be displaced


get

public List get(Object aKey)
retrieve all values for a given key


remove

public List remove(Object aKey)
remove all values for the given key


remove

public boolean remove(Object aKey,
                      Object aValue)
remove a given value index under a given key

Returns:
true if the value was removed

size

public int size()
return the number of entries in the map


clear

public void clear()
remove all entriues from the map


valueIterator

public Iterator valueIterator()
return an iterator over all values


keyIterator

public Iterator keyIterator()
return an iterator over all keys


NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.