Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.aendvari.common.util
Class MultiHashMap  view MultiHashMap download MultiHashMap.java

java.lang.Object
  extended bycom.aendvari.common.util.MultiHashMap
All Implemented Interfaces:
java.util.Map

public class MultiHashMap
extends java.lang.Object
implements java.util.Map

Implements java.util.Map using a java.util.HashMap. This Map class allows for multiple values for a single key.

Below is how the multi map is setup:

	HASH_MAP
	{
		HASH_KEY => (
				new Collection(
					Object, Object, etc...
				)
		),

		HASH_KEY => (
				new Collection(
					Object, Object, etc...
				)
		),

		etc...
	}
 

NOTE: This class DOES NOT implement the following:


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
private  java.util.HashMap map
          The java.util.HashMap that this class uses
 
Constructor Summary
MultiHashMap()
          Constructs a new, empty map with a default capacity and load factor, which is 0.75.
MultiHashMap(int initialCapacity)
          Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75.
MultiHashMap(int initialCapacity, float loadFactor)
          Constructs a new, empty map with the specified initial capacity and the specified load factor.
 
Method Summary
 void clear()
          See HashMap.clear()>HashMap.clear() 55
 java.lang.Object clone()
          See HashMap.clone()>HashMap.clone() 55
 boolean containsCollisionValue(java.lang.Object value)
          Determines if the given value matches any of the "collision" values
 boolean containsKey(java.lang.Object key)
          See HashMap.containsKey(Object)>HashMap.containsKey(Object) 55
 boolean containsValue(java.lang.Object value)
          See HashMap.containsValue(Object)>HashMap.containsValue(Object) 55
 java.util.Set entrySet()
          See HashMap.entrySet()>HashMap.entrySet() 55
 java.lang.Object get(java.lang.Object key)
          See HashMap.get(Object)>HashMap.get(Object) 55
 java.util.Collection get(java.lang.String key)
          Get a Collection of the collided values at a give key.
 java.util.Collection getCollisionList(java.lang.Object key)
          Returns the Collection of "collided" values.
 boolean isEmpty()
          See HashMap.isEmpty()>HashMap.isEmpty() 55
 java.util.Set keySet()
          See HashMap.keySet()>HashMap.keySet() 55
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          See HashMap.put(Object, Object)>HashMap.put(Object, Object) 55 .
 void putAll(java.util.Map t)
          This operation is not supported.
 java.lang.Object remove(java.lang.Object key)
          See HashMap.remove(Object)>HashMap.remove(Object) 55
 int size()
          See HashMap.size()>HashMap.size() 55
 int size(java.lang.String key)
          Get the size of the collided values for a given key.
 java.util.Collection values()
          See HashMap.values()>HashMap.values() 55
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

map

private java.util.HashMap map
The java.util.HashMap that this class uses

Constructor Detail

MultiHashMap

public MultiHashMap()

Constructs a new, empty map with a default capacity and load factor, which is 0.75.


MultiHashMap

public MultiHashMap(int initialCapacity)

Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75.


MultiHashMap

public MultiHashMap(int initialCapacity,
                    float loadFactor)

Constructs a new, empty map with the specified initial capacity and the specified load factor.

Method Detail

containsCollisionValue

public boolean containsCollisionValue(java.lang.Object value)

Determines if the given value matches any of the "collision" values


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
See HashMap.put(Object, Object)>HashMap.put(Object, Object) 55 . Places collided values into a Collection instead of replacing previous value.

Specified by:
put in interface java.util.Map

get

public java.util.Collection get(java.lang.String key)
Get a Collection of the collided values at a give key.


getCollisionList

public java.util.Collection getCollisionList(java.lang.Object key)
Returns the Collection of "collided" values.


putAll

public void putAll(java.util.Map t)
            throws java.lang.UnsupportedOperationException

This operation is not supported.

Specified by:
putAll in interface java.util.Map

size

public int size()
See HashMap.size()>HashMap.size() 55

Specified by:
size in interface java.util.Map

size

public int size(java.lang.String key)
Get the size of the collided values for a given key.


isEmpty

public boolean isEmpty()
See HashMap.isEmpty()>HashMap.isEmpty() 55

Specified by:
isEmpty in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
See HashMap.containsValue(Object)>HashMap.containsValue(Object) 55

Specified by:
containsValue in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
See HashMap.containsKey(Object)>HashMap.containsKey(Object) 55

Specified by:
containsKey in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)
See HashMap.get(Object)>HashMap.get(Object) 55

Specified by:
get in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
See HashMap.remove(Object)>HashMap.remove(Object) 55

Specified by:
remove in interface java.util.Map

clear

public void clear()
See HashMap.clear()>HashMap.clear() 55

Specified by:
clear in interface java.util.Map

clone

public java.lang.Object clone()
See HashMap.clone()>HashMap.clone() 55


keySet

public java.util.Set keySet()
See HashMap.keySet()>HashMap.keySet() 55

Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
See HashMap.values()>HashMap.values() 55

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
See HashMap.entrySet()>HashMap.entrySet() 55

Specified by:
entrySet in interface java.util.Map