|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.common.util.BaseArrayMap
com.sdm.quasar.client.core.common.util.ArrayMap
Storage mechanism for key-value pairs.
For few pairs this will be an array of alternating key-value pairs.
As it grows larger it is scaled up to a HashMap.
Note: Althrough this implementation supports the Map
interface, it is not always performant for some Map methods,
like the view-sets and collections. Especially the Map entries are not supported
fully performant to avoid larger space requirements for small mappings. For large
mappings all the map views are taken from the underlying HashMap,
so performance should be ok in general.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
ArrayMap()
Constructor for ArrayMap. |
|
| Method Summary | |
void |
clear()
Removes all the mappings. |
java.lang.Object |
clone()
Clones the ArrayMap. |
boolean |
containsKey(java.lang.Object key)
Returns true if we have a value for the key. |
boolean |
containsValue(java.lang.Object value)
Returns true if there map one or more keys
to the specified value. |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Gets the value for key |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings.
|
java.util.Iterator |
iterateKeys()
Returns an iterator of the keys in this BaseArrayMap. |
java.util.Iterator |
iterateValues()
Returns an iterator of the values in this BaseArrayMap. |
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Put the key-value pair into storage |
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified map to this map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the key and its value Returns the value for the pair removed |
int |
size()
Returns the number of pairs in storage |
java.util.Collection |
values()
|
| Methods inherited from class com.sdm.quasar.client.core.common.util.BaseArrayMap |
copyTo, elementsToString, eq, equals, getKeys, hashCode, iterateMapEntries, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
| Constructor Detail |
public ArrayMap()
| Method Detail |
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class BaseArrayMapkey - the key objectvalue - the value object
null
if there was no mapping for key. A null return can also
indicate that the map previously associated null with the
specified key.public java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapget in class BaseArrayMapkey - the key object to look for
public int size()
size in interface java.util.Mapsize in class BaseArrayMappublic boolean isEmpty()
true if this map contains no key-value mappings.
This implementation returns size()==0.
isEmpty in interface java.util.MapisEmpty in class BaseArrayMappublic boolean containsKey(java.lang.Object key)
true if we have a value for the key.
containsKey in interface java.util.MapcontainsKey in class BaseArrayMaptrue if we have a value for the key.public boolean containsValue(java.lang.Object value)
true if there map one or more keys
to the specified value.
containsValue in interface java.util.MapcontainsValue in class BaseArrayMaptrue if maps one or more keys to the
specified value.public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class BaseArrayMapkey - the key object
public void clear()
clear in interface java.util.Mapclear in class BaseArrayMappublic java.util.Iterator iterateKeys()
BaseArrayMap. The general
contract for the iterateKeys method is that an Iterator
object is returned that will generate all the keys for which this
BaseArrayMap contains entries.
iterateKeys in class BaseArrayMapBaseArrayMap.public java.util.Iterator iterateValues()
BaseArrayMap. The general
contract for the iterateValues method is that an Iterator
object is returned that will generate all the values for which this
BaseArrayMap contains entries.
iterateValues in class BaseArrayMapBaseArrayMap.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
ArrayMap. This gives the clone
its own copy of the key/value list.
java.lang.CloneNotSupportedExceptionpublic void putAll(java.util.Map t)
putAll in interface java.util.MapputAll in class BaseArrayMapt - the map to put mappings frompublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Map
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||