Package com.tangosol.util
Class LiteMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.oracle.coherence.common.collections.InflatableMap<K,V>
com.tangosol.util.LiteMap<K,V>
- All Implemented Interfaces:
ExternalizableLite
,Externalizable
,Serializable
,Cloneable
,Map<K,
V>
- Direct Known Subclasses:
JsonMap
public class LiteMap<K,V>
extends com.oracle.coherence.common.collections.InflatableMap<K,V>
implements ExternalizableLite
An implementation of java.util.Map that is optimal (in terms of both size
and speed) for very small sets of data but still works excellently with
large sets of data. This implementation is not thread-safe.
The LiteMap implementation switches at runtime between several different sub-implementations for storing the Map of objects, described here:
- "empty map" - a map that contains no data;
- "single entry" - a reference directly to a single map entry
- "Object[]" - a reference to an array of entries; the item limit for this implementation is determined by the THRESHOLD constant;
- "delegation" - for more than THRESHOLD items, a map is created to delegate the map management to; sub-classes can override the default delegation class (java.util.HashMap) by overriding the factory method instantiateMap.
The LiteMap implementation supports the null key value.
- Author:
- cp 06/29/99
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.coherence.common.collections.InflatableMap
com.oracle.coherence.common.collections.InflatableMap.EntryIterator<K,
V>, com.oracle.coherence.common.collections.InflatableMap.EntrySet Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields inherited from class com.oracle.coherence.common.collections.InflatableMap
I_OTHER, m_nImpl, m_oContents, THRESHOLD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Restore the contents of this object by loading the object's state from the passed DataInput object.void
writeExternal
(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class com.oracle.coherence.common.collections.InflatableMap
checkShrinkFromOther, clear, clone, containsKey, ensureRuntimeException, entrySet, get, instantiateEntry, instantiateEntrySet, instantiateMap, isEmpty, put, readExternal, remove, size, writeExternal
Methods inherited from class java.util.AbstractMap
containsValue, equals, hashCode, keySet, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
LiteMap
public LiteMap()Construct a LiteMap. -
LiteMap
Construct a LiteMap with the same mappings as the given map.- Parameters:
map
- the map whose mappings are to be placed in this map.
-
-
Method Details
-
readExternal
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternal
in interfaceExternalizableLite
- Parameters:
in
- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException
- if an I/O exception occurs
-
writeExternal
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternal
in interfaceExternalizableLite
- Parameters:
out
- the DataOutput stream to write the state of this object to- Throws:
IOException
- if an I/O exception occurs
-