Set
Data structure which only holds unique values. Set is implemented as immutable array.
#
ConstructionUse one of three available named constructors: empty
, of
or ofAll
#
MethodsYou can add
new element, remove
existing one and check if given $element
exist with contains
.
If given $element
already exists in set, same instance will be returned.
You can also join two sets with union
. The merged set will contain only unique values.
diff
returns a set containing all the entries from set that are not present in given set: