Class MutableChampVectorSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jhotdraw8.icollection.impl.champ.AbstractMutableChampSet<E,org.jhotdraw8.icollection.impl.champ.SequencedElement<E>>
org.jhotdraw8.icollection.MutableChampVectorSet<E>
Type Parameters:
E - the element type
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, SequencedCollection<E>, SequencedSet<E>, Set<E>, ReadOnlyCollection<E>, ReadOnlySequencedCollection<E>, ReadOnlySequencedSet<E>, ReadOnlySet<E>

public class MutableChampVectorSet<E> extends org.jhotdraw8.icollection.impl.champ.AbstractMutableChampSet<E,org.jhotdraw8.icollection.impl.champ.SequencedElement<E>> implements ReadOnlySequencedSet<E>, SequencedSet<E>
Implements the SequencedSet interface using a Compressed Hash-Array Mapped Prefix-tree (CHAMP) and a bit-mapped trie (Vector).

Features:

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

Performance characteristics:

  • add: O(1) amortized
  • remove: O(1)
  • contains: O(1)
  • toImmutable: O(1) + O(log N) distributed across subsequent updates in this set
  • clone: O(1) + O(log N) distributed across subsequent updates in this set and in the clone
  • iterator creation: O(1)
  • iterator.next: O(1)
  • getFirst, getLast: O(1)

Implementation details:

See description at ChampVectorSet.

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: