Set:
Filter:
Classes | Collections > Unordered

Set : Collection : Object

a set according to equality
Source: Set.sc
Subclasses: Dictionary, IdentitySet

Description

A Set is s collection of objects, no two of which are equal. Most of its methods are inherited from Collection. The contents of a Set are unordered. You must not depend on the order of items in a set. For an ordered set, see OrderedIdentitySet.

Class Methods

Inherited class methods

Undocumented class methods

Set.new(n: 2)

Instance Methods

Adding and Removing

.add(item)

Add anObject to the Set. An object which is equal to an object already in the Set will not be added.

.remove(item)

Remove anObject from the Set.

Iteration

.do(function)

Evaluates function for each item in the Set. The function is passed two arguments, the item and an integer index.

.keyAt(index)

Returns the object at the internal index. This index is not deterministic.

Set specific operations

.sect(that)

&(that)

Return the set theoretical intersection of this and that.

.union(that)

|(that)

Return the set theoretical union of this and that.

.difference(that)

-(that)

Return the set of all items which are elements of this, but not of that.

.symmetricDifference(that)

--(that)

Return the set of all items which are not elements of both this and that.

.isSubsetOf(that)

Returns true if all elements of this are also elements of that.

Inherited instance methods

Undocumented instance methods

.array

.array = value

.asSet

.choose

.clear

.copy

.findMatch(item)

.fixCollisionsFrom(index)

.includes(item)

.makeEmpty

.pop

.scanFor(obj)

.size

.species

.unify

Examples