Collection.ts is a collection framework providing lazy, efficient, and generic collections for TypeScript.
Collection.ts cannot exist without the Poly-collection framework on Scala.
Hash map and hash sets (and other keyed/hashed structures) support custom classes, as long as an equivalence strategy (an
Eq<K>for the key type
K) and a hashing strategy (a
Hash<K>) are provided. A related interface,
Ord<K>, is provided for custom ordering definitions.
Almost all higher-order functions (e.g.,
reduce, ...) are lazy. This means that these transformations only define (instead of create) a new collection. No actual computation will happen until the elements in the new collection are accessed.
The higher-order functions return the most specific abstract type possible sa their results. For example, a
ArraySeqwill not return another
ArraySeq(as in Scala), or merely
Iterable(as in C#). It will return
RandomAccessSeq, which is the most fine-grained abstract class possible for
ArraySeqs. This is an idea borrowed from Poly-collection.
for ofsupport. The fact that the
Iterableclass in Collection.ts implements the
Collection.ts is written with TypeScript 2.2.1.