Package io.vavr.collection
Purely functional collections based on Traversable.
Performance Characteristics of Vavr Collections
head() | tail() | get(int) | update(int, T) | prepend(T) | append(T) | |
---|---|---|---|---|---|---|
Array | const | linear | const | linear | linear | linear |
CharSeq | const | linear | const | linear | linear | linear |
Iterator | const | const | — | — | — | — |
List | const | const | linear | linear | const | linear |
Queue | const | consta | linear | linear | const | const |
PriorityQueue | log | log | — | — | log | log |
Stream | const | const | linear | linear | constlazy | constlazy |
Vector | consteff | consteff | consteff | consteff | consteff | consteff |
contains/Key | add/put | remove | min | |
---|---|---|---|---|
HashMap | consteff | consteff | consteff | linear |
HashSet | consteff | consteff | consteff | linear |
LinkedHashMap | consteff | linear | linear | linear |
LinkedHashSet | consteff | linear | linear | linear |
Tree | log | log | log | log |
TreeMap | log | log | log | log |
TreeSet | log | log | log | log |
- 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
-
Interface Summary Interface Description AbstractMultimap.SerializableSupplier<T> ArrayModule ArrayType<T> Helper to replace reflective array access.BitSet<T> An immutableBitSet
implementation.BitSetModule CharSeq.CharFunction<R> CharSeq.CharUnaryOperator CharSeqModule CharSeqModule.Combinations Foldable<T> Interface of foldable data structures.HashArrayMappedTrie<K,V> An immutable Hash array mapped trie (HAMT).HashArrayMappedTrieModule IndexedSeq<T> Interface for immutable, indexed sequences.IndexedSeqModule IndexedSeqModule.Search Iterator<T> io.vavr.collection.Iterator
is a compositional replacement forjava.util.Iterator
whose purpose is to iterate once over a sequence of elements.IteratorModule LeafVisitor<T> LinearSeq<T> Interface for immutable, linear sequences.LinearSeqModule LinearSeqModule.Search List<T> An immutableList
is an eager sequence of elements.ListModule ListModule.Combinations ListModule.SplitAt Map<K,V> An immutableMap
interface.Maps.OfEntries<K,V,M extends Map<K,V>> Multimap<K,V> An immutableMultimap
interface.NodeModifier Ordered<T> An ordered collection interface.RedBlackTree<T> Purely functional Red/Black Tree, inspired by Kazu Yamamoto's Haskell implementation.RedBlackTreeModule Seq<T> Interface for immutable sequential data structures.Set<T> An immutableSet
interface.SortedMap<K,V> An immutableSortedMap
interface.SortedMultimap<K,V> An immutableSortedMultimap
interface.SortedSet<T> An immutableSortedSet
interface.Stream<T> An immutableStream
is lazy sequence of elements which may be infinitely long.StreamModule StreamModule.Combinations StreamModule.DropRight StreamModule.StreamFactory Traversable<T> An interface for inherently recursive, multi-valued data structures.TraversableModule Tree<T> A general Tree interface.TreeMap.EntryComparator<K,V> TreeModule Because the empty treeEmpty
cannot be a child of an existing tree, method implementations distinguish between the empty and non-empty case.VectorModule -
Class Summary Class Description AbstractIterator<T> Provides a commonObject.toString()
implementation.AbstractMultimap<K,V,M extends Multimap<K,V>> AnMultimap
implementation (not intended to be public).AbstractQueue<T,Q extends AbstractQueue<T,Q>> Array<T> Array is a Traversable wrapper forObject[]
containing elements of typeT
.ArrayModule.Combinations ArrayType.BooleanArrayType ArrayType.ByteArrayType ArrayType.CharArrayType ArrayType.DoubleArrayType ArrayType.FloatArrayType ArrayType.IntArrayType ArrayType.LongArrayType ArrayType.ObjectArrayType ArrayType.ShortArrayType BitMappedTrie<T> A `bit-mapped trie` is a very wide and shallow tree (for integer indices the depth will be `≤6`).BitSet.Builder<T> BitSetModule.AbstractBitSet<T> BitSetModule.BitSet1<T> BitSetModule.BitSet2<T> BitSetModule.BitSetIterator<T> BitSetModule.BitSetN<T> CharSeq The CharSeq (read: character sequence) collection essentially is a rich String wrapper having all operations we know from the functional Vavr collections.Collections Internal class, containing helpers.Collections.IterableWithSize<T> Comparators INTERNAL: CommonComparator
related functions (not intended to be public).HashArrayMappedTrieModule.AbstractNode<K,V> An abstract base class for nodes of a HAMT.HashArrayMappedTrieModule.ArrayNode<K,V> Representation of a HAMT array node.HashArrayMappedTrieModule.EmptyNode<K,V> The empty node.HashArrayMappedTrieModule.IndexedNode<K,V> Representation of a HAMT indexed node.HashArrayMappedTrieModule.LeafList<K,V> Representation of a HAMT leaf node with more than one element.HashArrayMappedTrieModule.LeafNode<K,V> Representation of a HAMT leaf.HashArrayMappedTrieModule.LeafNodeIterator<K,V> HashArrayMappedTrieModule.LeafSingleton<K,V> Representation of a HAMT leaf node with single element.HashMap<K,V> An immutableHashMap
implementation based on a Hash array mapped trie (HAMT).HashMultimap<K,V> HashMultimap.Builder<V> HashSet<T> An immutableHashSet
implementation.HashSet.SerializationProxy<T> A serialization proxy which, in this context, is used to deserialize immutable, linked Lists with final instance fields.IndexedSeqModule.Slice IteratorModule.BigDecimalHelper IteratorModule.CachedIterator<T> IteratorModule.ConcatIterator<T> IteratorModule.ConcatIterator.Cell<T> IteratorModule.DistinctIterator<T,U> IteratorModule.EmptyIterator IteratorModule.GroupedIterator<T> JavaConverters THIS CLASS IS INTENDED TO BE USED INTERNALLY ONLY!JavaConverters.HasDelegate<C extends Traversable<?>> Encapsulates the access to delegate and performs mutability checks.JavaConverters.ListView<T,C extends Seq<T>> JavaConverters.ListView.Iterator<T,C extends Seq<T>> JavaConverters.ListView.ListIterator<T,C extends Seq<T>> LinearSeqModule.Slice LinkedHashMap<K,V> An immutableLinkedHashMap
implementation that has predictable (insertion-order) iteration.LinkedHashMultimap<K,V> ALinkedHashMap
-based implementation ofMultimap
LinkedHashMultimap.Builder<V> LinkedHashSet<T> An immutableHashSet
implementation that has predictable (insertion-order) iteration.LinkedHashSet.SerializationProxy<T> A serialization proxy which, in this context, is used to deserialize immutable, linked Lists with final instance fields.List.Cons<T> Non-emptyList
, consisting of ahead
and atail
.List.Cons.SerializationProxy<T> A serialization proxy which, in this context, is used to deserialize immutable, linked Lists with final instance fields.List.Nil<T> Representation of the singleton emptyList
.Maps INTERNAL: CommonMap
functions (not intended to be public).Multimaps INTERNAL: CommonMultimap
functions (not intended to be public).NaturalComparator<T> PriorityQueue<T> A PriorityQueue.PriorityQueueBase PriorityQueueBase.Node<T> Queue<T> An immutableQueue
stores elements allowing a first-in-first-out (FIFO) retrieval.RedBlackTreeModule.Empty<T> The empty tree node.RedBlackTreeModule.Node<T> A non-empty tree node.Stream.Cons<T> Non-emptyStream
, consisting of ahead
, andtail
.Stream.Empty<T> The empty Stream.StreamModule.AppendElements<T> StreamModule.AppendSelf<T> StreamModule.ConsImpl<T> StreamModule.FlatMapIterator<T,U> StreamModule.SerializationProxy<T> A serialization proxy which, in this context, is used to deserialize immutable, linked Streams with final instance fields.StreamModule.StreamIterator<T> Tree.Empty<T> The empty tree.Tree.Node<T> Represents a tree node.Tree.Node.SerializationProxy<T> A serialization proxy which, in this context, is used to deserialize immutable nodes with final instance fields.TreeMap<K,V> SortedMap implementation, backed by a Red/Black Tree.TreeMap.EntryComparator.Natural<K,V> TreeMap.EntryComparator.Specific<K,V> TreeMultimap<K,V> TreeMultimap.Builder<V> TreeSet<T> SortedSet implementation, backed by a Red/Black Tree.Vector<T> Vector is the default Seq implementation that provides effectively constant time access to any element.VectorModule.Combinations -
Enum Summary Enum Description HashArrayMappedTrieModule.Action JavaConverters.ChangePolicy Multimap.ContainerType RedBlackTree.Color Tree.Order Tree traversal order. -
Annotation Types Summary Annotation Type Description GwtIncompatible