Class AbstractTxnMap<K,V>

java.lang.Object
org.multiverse.collections.AbstractTxnMap<K,V>
All Implemented Interfaces:
Map<K,V>, TxnMap<K,V>
Direct Known Subclasses:
NaiveTxnHashMap

public abstract class AbstractTxnMap<K,V> extends Object implements TxnMap<K,V>
  • Field Details

    • stm

      protected final Stm stm
    • defaultRefFactory

      protected final TxnRefFactory defaultRefFactory
  • Constructor Details

    • AbstractTxnMap

      public AbstractTxnMap(Stm stm)
  • Method Details

    • getStm

      public final Stm getStm()
      Description copied from interface: TxnMap
      Returns the Stm that manages this TxnMap.
      Specified by:
      getStm in interface TxnMap<K,V>
      Returns:
      the Stm that manages this map.
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • isEmpty

      public boolean isEmpty(Txn tx)
      Description copied from interface: TxnMap
      Returns true if this map contains no key-value mappings.
      Specified by:
      isEmpty in interface TxnMap<K,V>
      Returns:
      true if this map contains no key-value mappings
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • keySet

      public TxnSet<K> keySet()
      Description copied from interface: TxnMap
      Returns a TxnSet view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
      Specified by:
      keySet in interface Map<K,V>
      Specified by:
      keySet in interface TxnMap<K,V>
      Returns:
      a set view of the keys contained in this map
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • putAll

      public void putAll(Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<K,V>
    • putAll

      public void putAll(Txn tx, Map<? extends K,? extends V> m)
      Description copied from interface: TxnMap
      Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
      Specified by:
      putAll in interface TxnMap<K,V>
      m - mappings to be stored in this map
    • values

      public TxnCollection<V> values()
      Description copied from interface: TxnMap
      Returns a TxnCollection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
      Specified by:
      values in interface Map<K,V>
      Specified by:
      values in interface TxnMap<K,V>
      Returns:
      a collection view of the values contained in this map
    • entrySet

      public TxnSet<Map.Entry<K,V>> entrySet()
      Description copied from interface: TxnMap
      Returns a TxnSet view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in interface TxnMap<K,V>
      Returns:
      a set view of the mappings contained in this map
    • toString

      public String toString()
      Overrides:
      toString in class Object