Files
swift-collections/Sources/Collections/Collections.docc/Collections.md
T

2.0 KiB

Collections

Swift Collections is an open-source package of data structure implementations for the Swift programming language.

Overview

Additional Resources

Modules

  • Basic Containers - RigidArray, a fixed capacity and no implicit resizing dynamic non-copyable array capable of storing non-copyable elements. UniqueArray, an implicitly resizable dynamic non-copyable array capable of storing non-copyable elements.
  • Bit Collections - BitSet and BitArray, dynamic bit collections.
  • Deque Module - Deque<Element>, a double-ended queue backed by a ring buffer. Deques are range-replaceable, mutable, random-access collections.
  • Heap Module - Heap, a min-max heap backed by an array, suitable for use as a priority queue.
  • Ordered Collections - OrderedSet<Element>, a variant of the standard Set where the order of items is well-defined and items can be arbitrarily reordered. Uses a ContiguousArray as its backing store, augmented by a separate hash table of bit packed offsets into it. OrderedDictionary<Key, Value>, an ordered variant of the standard Dictionary, providing similar benefits.
  • Hash Tree Collections - TreeSet and TreeDictionary, persistent hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). These work similar to the standard Set and Dictionary, but they excel at use cases that mutate shared copies, offering dramatic memory savings and radical time improvements.