var Set = require("collections/set");
A collection of unique values.
The constructor will add all of the values if any are given. If the values are a map, the keys will be lost.
hash arguments override the set’s
contentCompare methods and determine where to store values and whether they
getDefault argument overrides the set’s
method, which will be called by
get if it cannot find an equivalent value
within the set.
The purpose of
get is less obvious on a
Set than a
Map, since you would
not often need to find a value you already have.
However, by virtue of overriding
contentHash, it is
possible to search for a value using an “equivalent” place-holder.
This is how maps use sets to find [key, value] entries when they only know the
Set is backed by a
FastSet and a
List is called
order and tracks the iteration order of the
Values are produced in the order they were first inserted.
FastSet is called
store and ensures uniqueness and very fast searches.
FastSet stores nodes form the
order list but hashes and compares them by
Order constructors can be overridden by inheritors.