Package org.javarosa.core.util
Class Map<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.javarosa.core.util.OrderedMap<K,V>
org.javarosa.core.util.Map<K,V>
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
public class Map<K,V> extends OrderedMap<K,V>
A Map is a data object that maintains a map from one set of data
objects to another. This data object is superior to a Hashtable
in instances where O(1) lookups are not a priority, due to its
smaller memory footprint.
Lookups in a map are accomplished in O(n) time.
TODO: Figure out if this actually works anymore!
(Is actually smaller in memory than a hashtable)
- Author:
- Clayton Sims
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidclear()booleancontains(Object value)booleancontainsKey(Object key)Whether or not the key is bound in this mapVelementAt(int index)Enumerationelements()Vget(Object key)intindexOfKey(K key)booleanisEmpty()ObjectkeyAt(int index)Enumerationkeys()Vput(K key, V value)Places the key/value pair in this map.Vremove(Object key)Removes any mapping from the given keyvoidremoveAt(int i)voidreset()Removes all keys and values from this map.voidseal()intsize()StringtoString()Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, merge, putAll, putIfAbsent, remove, replace, replaceMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, hashCode, merge, putAll, putIfAbsent, remove, replace, replace
-
Constructor Details
-
Method Details
-
put
Places the key/value pair in this map. Any existing mapping keyed by the key parameter is removed. -
size
public int size() -
get
-
remove
Removes any mapping from the given key -
reset
public void reset()Removes all keys and values from this map. -
containsKey
Whether or not the key is bound in this map- Specified by:
containsKeyin interfaceMap<K,V>- Overrides:
containsKeyin classHashMap<K,V>- Parameters:
key-- Returns:
- True if there is an object bound to the given key in this map. False otherwise.
-
clear
public void clear() -
elementAt
-
elements
-
indexOfKey
-
keyAt
-
keys
-
removeAt
public void removeAt(int i) -
toString
- Overrides:
toStringin classOrderedMap<K,V>
-
isEmpty
public boolean isEmpty() -
contains
-
seal
public void seal()
-