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:

  1. "empty map" - a map that contains no data;
  2. "single entry" - a reference directly to a single map entry
  3. "Object[]" - a reference to an array of entries; the item limit for this implementation is determined by the THRESHOLD constant;
  4. "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>

    Nested classes/interfaces inherited from interface java.util.Map

    Map.Entry<K,V>
  • Field Summary

    Fields inherited from class com.oracle.coherence.common.collections.InflatableMap

    I_OTHER, m_nImpl, m_oContents, THRESHOLD
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a LiteMap.
    LiteMap(Map<? extends K,? extends V> map)
    Construct a LiteMap with the same mappings as the given map.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Restore the contents of this object by loading the object's state from the passed DataInput object.
    void
    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
  • Constructor Details

    • LiteMap

      public LiteMap()
      Construct a LiteMap.
    • LiteMap

      public LiteMap(Map<? extends K,? extends V> map)
      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

      public void readExternal(DataInput in) throws IOException
      Restore the contents of this object by loading the object's state from the passed DataInput object.
      Specified by:
      readExternal in interface ExternalizableLite
      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

      public void writeExternal(DataOutput out) throws IOException
      Save the contents of this object by storing the object's state into the passed DataOutput object.
      Specified by:
      writeExternal in interface ExternalizableLite
      Parameters:
      out - the DataOutput stream to write the state of this object to
      Throws:
      IOException - if an I/O exception occurs