|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.util.OpenHashMap<K,V>
public class OpenHashMap<K,V>
A HashMap that allows more than one value associated to the same key. This object is replacing the com.nitido.util.OpenHash. It performs much better than the old OpenHash object because none of its methods are synchronized.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
OpenHashMap()
Constructs a new, empty OpenHashMap. |
|
OpenHashMap(java.util.Map<? extends K,? extends V> hash)
Constructs a new OpenHashMap, copying the contents of the passed in HashMap object into the OpenHashMap. |
|
OpenHashMap(OpenHashMap<? extends K,? extends V> hash)
Copy constructor. |
Method Summary | |
---|---|
void |
clear()
This method removes all entries from the hashMap. |
boolean |
containsKey(java.lang.Object key)
Returns true if this OpenHashMap contains a key equal to the one passed in. |
boolean |
containsValue(K key,
V value)
Returns true if this OpenHashMap contains the given value with the given key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this OpenHashMap contains the given value. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Required by java.util.Map. |
V |
get(java.lang.Object key)
This method retrieves the first value which corresponds to the key given, or null if no value is mapped to that key. |
V |
get(java.lang.Object key,
int index)
This method retrieves the specified value which corresponds to the key given and the specified index, or null if no value is mapped to that key. |
int |
getNumberOfValues(java.lang.Object key)
Returns number of value object stored under the specified key. |
V |
getValue(java.lang.Object key,
int index)
Return the value specified by the index. |
java.util.List<V> |
getValues(java.lang.Object key)
Returns a arrayList of all the values associated to the given key. |
boolean |
isEmpty()
Required by java.util.Map. |
java.util.Set<K> |
keySet()
Convenience alias to getKeys() for HashMap users. |
V |
put(K key,
V value)
This method maps a key to a value in the hashMap. |
void |
putAll(java.util.Map<? extends K,? extends V> inMap)
Required by java.util.Map. |
void |
putValues(K key,
java.util.Collection<? extends V> values)
This method maps a key to a value in the hashMap. |
V |
remove(K key,
int index)
Remove the specified value associated to the key. |
V |
remove(K key,
V value)
Removes the key/value pair specified. |
V |
remove(java.lang.Object key)
Removes all the values that are associated with the given key. |
void |
set(K key,
int index,
V value)
This method replace the specified value with the new value. |
void |
set(K key,
V value)
This method maps a key to a value in the hashMap and replace the all old mapped values if they exist. |
void |
setValues(K key,
java.util.Collection<? extends V> values)
This method replace all old mapped values with the new ones. |
int |
size()
Returns the number of keys in this OpenHashMap. |
java.lang.String |
toString()
Utility methods to list all the entries in the hashMap. |
java.util.Collection<V> |
values()
Required by java.util.Map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public OpenHashMap()
public OpenHashMap(java.util.Map<? extends K,? extends V> hash)
hash
- The HashMap whose contents are copied into this OpenHashMap.public OpenHashMap(OpenHashMap<? extends K,? extends V> hash)
Method Detail |
---|
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
key
- A key in the hashMap.
public V get(java.lang.Object key, int index)
key
- A key in the hashMap.
public java.util.Set<K> keySet()
keySet
in interface java.util.Map<K,V>
public int getNumberOfValues(java.lang.Object key)
key
- The key object to retrieve the value count from.
public java.util.List<V> getValues(java.lang.Object key)
key
- A key in the hashMap.
public V getValue(java.lang.Object key, int index)
key
- A key in the hashMap.index
- The index of the value to be fetched.
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
value
- The value to check for in this OpenHashMap.
public boolean containsValue(K key, V value)
key
- The key to search for in this OpenHashMap.value
- The value to search for in this OpenHashMap.
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
key
- The key to check.
public int size()
size
in interface java.util.Map<K,V>
public V put(K key, V value)
put
in interface java.util.Map<K,V>
key
- The object to be used as a key in the mapping.value
- The object which the key is being mapped to.
public void putValues(K key, java.util.Collection<? extends V> values)
key
- The object to be used as a key in the mapping.values
- The collection of the values associated to the key.public void set(K key, V value)
key
- The object to be used as a key in the mapping.value
- The object which the key is being mapped to.public void setValues(K key, java.util.Collection<? extends V> values)
key
- The object to be used as a key in the mapping.values
- The collection of values to be associated to the key.public void set(K key, int index, V value)
key
- The object to be used as a key in the mapping.index
- The index of the value to be replaced.value
- The object which the key is being mapped to.public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
key
- the key to be removed.
public V remove(K key, V value)
key
- The key in the key/value pair to remove.value
- The value in the key/value pair to remove.
public V remove(K key, int index)
key
- The key in the key/value pair to be removed.index
- The index of the value to be removed.public void clear()
clear
in interface java.util.Map<K,V>
public java.lang.String toString()
keyA: "valueA-1", "valueA-2", ... keyB: "valueB-1", "valueB-2", ...
toString
in class java.lang.Object
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
public void putAll(java.util.Map<? extends K,? extends V> inMap)
putAll
in interface java.util.Map<K,V>
public java.util.Collection<V> values()
values
in interface java.util.Map<K,V>
public boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.