Class 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:
    Serialized Form
    • Constructor Detail

      • 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 Detail

      • 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
        NotActiveException - if the object is not in its initial state, and therefore cannot be deserialized into
      • 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