Package io.vavr.collection


package io.vavr.collection
Purely functional collections based on Traversable.

Performance Characteristics of Vavr Collections

Time Complexity of Sequential Operations
  head() tail() get(int) update(int, T) prepend(T) append(T)
Arrayconstlinearconstlinearlinearlinear
CharSeqconstlinearconstlinearlinearlinear
Iteratorconstconst
Listconstconstlinearlinearconstlinear
Queueconstconstalinearlinearconstconst
PriorityQueueloglogloglog
Streamconstconstlinearlinearconstlazyconstlazy
Vectorconsteffconsteffconsteffconsteffconsteffconsteff

Time Complexity of Map/Set Operations
  contains/Key add/put remove min
HashMapconsteffconsteffconstefflinear
HashSetconsteffconsteffconstefflinear
LinkedHashMapconstefflinearlinearlinear
LinkedHashSetconstefflinearlinearlinear
Treeloglogloglog
TreeMaploglogloglog
TreeSetloglogloglog

  • const · constant time
  • consta · amortized constant time, few operations may take longer
  • consteff · effectively constant time, depending on assumptions like distribution of hash keys
  • constlazy · lazy constant time, the operation is deferred
  • log · logarithmic time
  • linear · linear time
  • Class
    Description
    Array is a Traversable wrapper for Object[] containing elements of type T.
    An immutable BitSet implementation.
     
    The CharSeq (read: character sequence) collection essentially is a rich String wrapper having all operations we know from the functional Vavr collections.
     
     
    Interface of foldable data structures.
    HashMap<K,V>
    An immutable HashMap implementation based on a Hash array mapped trie (HAMT).
    A HashMap-based implementation of Multimap
     
    An immutable HashSet implementation.
    Interface for immutable, indexed sequences.
    io.vavr.collection.Iterator is a compositional replacement for java.util.Iterator whose purpose is to iterate once over a sequence of elements.
    Interface for immutable, linear sequences.
    An immutable LinkedHashMap implementation that has predictable (insertion-order) iteration.
    A LinkedHashMap-based implementation of Multimap
     
    An immutable HashSet implementation that has predictable (insertion-order) iteration.
    List<T>
    An immutable List is an eager sequence of elements.
    Non-empty List, consisting of a head and a tail.
    Representation of the singleton empty List.
    Map<K,V>
    An immutable Map interface.
    An immutable Multimap interface.
     
    An ordered collection interface.
    A PriorityQueue.
    An immutable Queue stores elements allowing a first-in-first-out (FIFO) retrieval.
    Seq<T>
    Interface for immutable sequential data structures.
    Set<T>
    An immutable Set interface.
    An immutable SortedMap interface.
    An immutable SortedMultimap interface.
    An immutable SortedSet interface.
    An immutable Stream is lazy sequence of elements which may be infinitely long.
    Non-empty Stream, consisting of a head, and tail.
    The empty Stream.
    An interface for inherently recursive, multi-valued data structures.
    Tree<T>
    A general Tree interface.
    The empty tree.
    Represents a tree node.
    Tree traversal order.
    TreeMap<K,V>
    SortedMap implementation, backed by a Red/Black Tree.
    A TreeMap-based implementation of Multimap
     
    SortedSet implementation, backed by a Red/Black Tree.
    Vector is the default Seq implementation that provides effectively constant time access to any element.