cats.collections

Type members

Classlikes

class AvlMap[K, V](val set: AvlSet[(K, V)])

A tree based immutable map.

A tree based immutable map.

Companion:
object
Source:
Map.scala
object AvlMap extends AvlMapInstances
Companion:
class
Source:
Map.scala
sealed abstract class AvlSet[A]

An immutable, ordered, extensional set

An immutable, ordered, extensional set

This data-structure maintains balance using the AVL algorithm.

Companion:
object
Source:
Set.scala
object AvlSet extends AvlSetInstances
Companion:
class
Source:
Set.scala
sealed abstract class BitSet

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).

Companion:
object
Source:
BitSet.scala
object BitSet
Companion:
class
Source:
BitSet.scala
sealed abstract class Dequeue[+A]

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

Companion:
object
Source:
Dequeue.scala
object Dequeue extends DequeueInstances
Companion:
class
Source:
Dequeue.scala
sealed trait DequeueInstances
sealed abstract class Diet[A]

Discrete Interval Encoding Tree (Diet). It stores subsets of types having a total order, a predecessor and a successor function described by Discrete[A]

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.

Companion:
object
Source:
Diet.scala
object Diet
Companion:
class
Source:
Diet.scala

Represent discrete operations that can be performed on A

Represent discrete operations that can be performed on A

Companion:
object
Source:
Discrete.scala
object Discrete
Companion:
class
Source:
Discrete.scala
class DisjointSets[T]
Companion:
object
Source:
DisjointSets.scala
final class HashMap[K, +V]

An immutable hash map using cats.kernel.Hash for hashing.

An immutable hash map using cats.kernel.Hash for hashing.

Implemented using the CHAMP encoding.

Type parameters:
K

the type of the keys contained in this hash map.

V

the type of the values contained in this hash map.

Value parameters:
hashKey

the cats.kernel.Hash instance used for hashing keys.

See also:
Companion:
object
Source:
HashMap.scala
object HashMap
Companion:
class
Source:
HashMap.scala
class HashMapMonoid[K, V](implicit evidence$1: Hash[K], V: Semigroup[V]) extends Monoid[HashMap[K, V]]
final class HashSet[A]

An immutable hash set using cats.kernel.Hash for hashing.

An immutable hash set using cats.kernel.Hash for hashing.

Implemented using the CHAMP encoding.

Type parameters:
A

the type of the elements contained in this hash set.

Value parameters:
hash

the cats.kernel.Hash instance used for hashing values.

See also:
Companion:
object
Source:
HashSet.scala
object HashSet
Companion:
class
Source:
HashSet.scala
sealed abstract class Heap[A]

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&apos;s paper and it does support the basic operations on a heap without compromising performance.

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&apos;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 function heapify.

Companion:
object
Source:
Heap.scala
object Heap
Companion:
class
Source:
Heap.scala
sealed abstract class PairingHeap[A]

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

Companion:
object
Source:
PairingHeap.scala
Companion:
class
Source:
PairingHeap.scala
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.

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.

Companion:
object
Source:
PartiallyOrderedSet.scala
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.

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.

Companion:
object
Source:
Predicate.scala
Companion:
class
Source:
Predicate.scala
final case class Range[A](start: A, end: A)

Represent an inclusive range [x, y] that can be generated by using discrete operations

Represent an inclusive range [x, y] that can be generated by using discrete operations

Companion:
object
Source:
Range.scala
object Range
Companion:
class
Source:
Range.scala
sealed abstract class TreeList[+A]

Implementation of "Purely Functional Random Access Lists" by Chris Okasaki. This gives O(1) cons and uncons, and 2 log_2 N lookup.

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.

Companion:
object
Source:
TreeList.scala
object TreeList
Companion:
class
Source:
TreeList.scala

Deprecated types

@deprecated("ISet has been renamed to Predicate.", "cats-collections 0.8.0")
type ISet[K] = Predicate[K]
Deprecated
Source:
package.scala

Value members

Deprecated fields

@deprecated("ISet has been renamed to Predicate.", "cats-collections 0.8.0")
val ISet: Predicate.type
Deprecated
Source:
package.scala