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