Class MutableChampVectorMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
org.jhotdraw8.icollection.impl.champ.AbstractMutableChampMap<K,V,org.jhotdraw8.icollection.impl.champ.SequencedEntry<K,V>>
org.jhotdraw8.icollection.MutableChampVectorMap<K,V>
Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Map.Entry<K,V>>, Map<K,V>, SequencedMap<K,V>, ReadOnlyMap<K,V>, ReadOnlySequencedMap<K,V>

public class MutableChampVectorMap<K,V> extends org.jhotdraw8.icollection.impl.champ.AbstractMutableChampMap<K,V,org.jhotdraw8.icollection.impl.champ.SequencedEntry<K,V>> implements SequencedMap<K,V>, ReadOnlySequencedMap<K,V>
Implements the SequencedMap interface using a Compressed Hash-Array Mapped Prefix-tree (CHAMP) and a bit-mapped trie (Vector).

Features:

  • supports up to 230 entries
  • allows null keys and null values
  • is mutable
  • is not thread-safe
  • iterates in the order, in which keys were inserted

Performance characteristics:

  • put, putFirst, putLast: O(1) in an amortized sense, because we sometimes have to renumber the elements.
  • remove: O(1) in an amortized sense, because we sometimes have to renumber the elements.
  • containsKey: O(1)
  • toImmutable: O(1) + O(log N) distributed across subsequent updates in this mutable map
  • clone: O(1) + O(log N) distributed across subsequent updates in this mutable map and in the clone
  • iterator creation: O(1)
  • iterator.next: O(1)
  • getFirst, getLast: O(1)

Implementation details:

See description at ChampVectorMap.

References:

Michael J. Steindorfer (2017). Efficient Immutable Collections.
michael.steindorfer.name
The Capsule Hash Trie Collections Library.
Copyright (c) Michael Steindorfer. BSD-2-Clause License
github.com
See Also: