Class CopyOnWriteMap<K,​V>

  • Type Parameters:
    K - The key type
    V - The value type
    All Implemented Interfaces:
    Cloneable, Map<K,​V>

    public class CopyOnWriteMap<K,​V>
    extends Object
    implements Map<K,​V>, Cloneable
    A thread-safe version of Map in which all operations that change the Map are implemented by making a new copy of the underlying Map. While the creation of a new Map can be expensive, this class is designed for cases in which the primary function is to read data from the Map, not to modify the Map. Therefore the operations that do not cause a change to this class happen quickly and concurrently.
    Author:
    Apache MINA Project
    • Constructor Detail

      • CopyOnWriteMap

        public CopyOnWriteMap()
        Creates a new instance of CopyOnWriteMap.
      • CopyOnWriteMap

        public CopyOnWriteMap​(int initialCapacity)
        Creates a new instance of CopyOnWriteMap with the specified initial size
        Parameters:
        initialCapacity - The initial size of the Map.
      • CopyOnWriteMap

        public CopyOnWriteMap​(Map<K,​V> data)
        Creates a new instance of CopyOnWriteMap in which the initial data being held by this map is contained in the supplied map.
        Parameters:
        data - A Map containing the initial contents to be placed into this class.