Package org.multiverse.collections

## 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>

- - ### Nested Class Summary

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

      `Map.Entry<K extends Object,​V extends Object>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected TxnRefFactory` | `defaultRefFactory` |
    `protected Stm` | `stm` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractTxnMap​(Stm stm)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clear()` |
    `boolean` | `containsKey​(Object key)` |
    `boolean` | `containsValue​(Object value)` |
    `TxnSet<Map.Entry<K,​V>>` | `entrySet()` | Returns a `TxnSet` view of the mappings contained in this map.
    `V` | `get​(Object key)` |
    `Stm` | `getStm()` | Returns the `Stm` that manages this `TxnMap`.
    `boolean` | `isEmpty()` |
    `boolean` | `isEmpty​(Txn tx)` | Returns `true` if this map contains no key-value mappings.
    `TxnSet<K>` | `keySet()` | Returns a `TxnSet` view of the keys contained in this map.
    `V` | `put​(K key, V value)` |
    `void` | `putAll​(Map<? extends K,​? extends V> m)` |
    `void` | `putAll​(Txn tx, Map<? extends K,​? extends V> m)` | Copies all of the mappings from the specified map to this map (optional operation).
    `V` | `remove​(Object key)` |
    `int` | `size()` |
    `String` | `toString()` |
    `TxnCollection<V>` | `values()` | Returns a `TxnCollection` view of the values contained in this map.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll`

    - ### Methods inherited from interface org.multiverse.api.collections.TxnMap

      `clear, containsKey, containsValue, entrySet, get, keySet, put, remove, size, toString, values`

- - ### Field Detail

    - #### stm

          protected final Stm stm

    - #### defaultRefFactory

          protected final TxnRefFactory defaultRefFactory

  - ### Constructor Detail

    - #### AbstractTxnMap

          public AbstractTxnMap​(Stm stm)

  - ### Method Detail

    - #### 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`