package collections
- Alphabetic
- By Inheritance
- collections
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- class AvlMap[K, V] extends AnyRef
A tree based immutable map.
- trait AvlMapInstances extends AnyRef
- sealed abstract class AvlSet[A] extends AnyRef
An immutable, ordered, extensional set
An immutable, ordered, extensional set
This data-structure maintains balance using the [AVL](https://en.wikipedia.org/wiki/AVL_tree) algorithm.
- trait AvlSetInstances extends AnyRef
- sealed abstract class BitSet extends AnyRef
A fast, immutable BitSet.
A fast, immutable BitSet.
A Bitset is a specialized type of set that tracks the
Int
values it contains: for each integer value, a BitSet uses a single bit to track whether the value is present (1) or absent (0). Bitsets are often sparse, since "missing" bits can be assumed to be zero.Unlike scala's default immutable this BitSet does not do a full copy on each added value.
Internally the implementation is a tree. Each leaf uses an Array[Long] value to hold up to 2048 bits, and each branch uses an Array[BitSet] to hold up to 32 subtrees (null subtrees are treated as empty).
Bitset treats the values it stores as 32-bit unsigned values, which is relevant to the internal addressing methods as well as the order used by
iterator
.The benchmarks suggest this bitset is MUCH faster than Scala's built-in bitset for cases where you may need many modifications and merges, (for example in a BloomFilter).
- sealed abstract class Dequeue[+A] extends AnyRef
Dequeue - A Double Ended Queue
Dequeue - A Double Ended Queue
Front Back
<- uncons --------- unsnoc -> cons -> --------- <- snoc
Based on the Bankers Double Ended Queue as described by C. Okasaki in "Purely Functional Data Structures"
A queue that allows items to be put onto either the front (cons) or the back (snoc) of the queue in constant time, and constant time access to the element at the very front or the very back of the queue. Dequeuing an element from either end is constant time when amortized over a number of dequeues.
This queue maintains an invariant that whenever there are at least two elements in the queue, neither the front list nor back list are empty. In order to maintain this invariant, a dequeue from either side which would leave that side empty constructs the resulting queue by taking elements from the opposite side
- sealed trait DequeueInstances extends AnyRef
- sealed abstract class Diet[A] extends AnyRef
Discrete Interval Encoding Tree (Diet).
Discrete Interval Encoding Tree (Diet). It stores subsets of types having a total order, a predecessor and a successor function described by Discrete[A]
Diet is a binary search tree where each node contains a range of values and the set of all nodes is a set of disjoint sets.
In the best case, when there are no "holes" in the stored set, the interval representation consists of just one single interval (node) and finding, inserting and deleting operations are O(1). In the worse case, where there are not two adjacent elements in the set, the representation is equivalent to a binary search tree.
- trait Discrete[A] extends AnyRef
Represent discrete operations that can be performed on A
- class DisjointSets[T] extends AnyRef
- trait DisjointSetsStates extends AnyRef
- sealed abstract class Heap[A] extends AnyRef
Heap
is a Purely Functional Binary Heap.Heap
is a Purely Functional Binary Heap. Binary Heaps are not common in the functional space, especially because their implementation depends on mutable arrays in order to gain in performance. This functional binary heap is based on Vladimir Kostyukov's paper and it does support the basic operations on a heap without compromising performance.It is important to note that we can, in fact, to create the Binary Heap in order O(n) from a
List
using the functionheapify
. - sealed abstract class PairingHeap[A] extends AnyRef
A PairingHeap is a heap with excellent empirical performance.
A PairingHeap is a heap with excellent empirical performance.
See: https://en.wikipedia.org/wiki/Pairing_heap in particular: https://en.wikipedia.org/wiki/Pairing_heap#Summary_of_running_times
Additionally, it supports an efficient O(1) combine operation
- trait PartiallyOrderedSet[F[_]] extends UnorderedFoldable[F]
This is a typeclass for Heap-like data-structures which are not totally ordered sets, but can produce the minimimum value, add and remove items.
- abstract class Predicate[-A] extends (A) => Boolean
An intensional set, which is a set which instead of enumerating its elements as a extensional set does, it is defined by a predicate which is a test for membership.
- trait PredicateInstances extends AnyRef
- final case class Range[A](start: A, end: A) extends Product with Serializable
Represent an inclusive range [x, y] that can be generated by using discrete operations
- sealed abstract class TreeList[+A] extends AnyRef
Implementation of "Purely Functional Random Access Lists" by Chris Okasaki.
Implementation of "Purely Functional Random Access Lists" by Chris Okasaki. This gives O(1) cons and uncons, and 2 log_2 N lookup.
A consequence of the log N complexity is that naive recursion on the inner methods will (almost) never blow the stack since the depth of the structure is log N, this greatly simplifies many methods. A key example is that unlike List, using a TreeList you can sequence and traverse very large lists without blowing the stack since the stack depth is only log N.
This data-structure is useful when you want fast cons and uncons, but also want to index. It does not have an optimized concatenation.
Deprecated Type Members
Value Members
- object AvlMap extends AvlMapInstances
- object AvlSet extends AvlSetInstances
- object BitSet
- object Dequeue extends DequeueInstances
- object Diet
- object Discrete
- object DisjointSets extends DisjointSetsStates
- object Heap
- object PairingHeap
- object PartiallyOrderedSet extends Serializable
- object Predicate extends PredicateInstances
- object Range extends Serializable
- object TreeList extends TreeListInstances0