Set$Typings<T > extension
Properties
count
↔ num
This read-only property is the number of elements in the Set.
getter/setter pair
iterator
↔ Iterator <T >
Gets an object that you can use for iterating over the Set.
The value will be a member of the Set.
Typical usage:
getter/setter pair
size
↔ num
This read-only property is the number of elements in the Set.
getter/setter pair
Methods
add (T val )
→ Set <T >
Adds a given value to the Set, if not already present.
addAll (Object coll )
→ Set <T >
Adds all of the values of a collection to this Set.
all (bool pred (T ) )
→ bool
This is true if all invocations of the given predicate on items in the collection are true.
any (bool pred (T ) )
→ bool
This is true if any invocation of the given predicate on items in the collection is true.
clear ()
→ void
Clears the Set.
This sets the #count to zero.
contains (T val )
→ bool
Returns whether the given value is in this Set.
@param {T} val The value to check.
@return {boolean} Whether or not the value is contained within the Set.
containsAll (Iterable <T > coll )
→ bool
Returns true if all of the values of a given collection are in this Set.
@param {Iterable.
containsAny (Iterable <T > coll )
→ bool
Returns true if any of the values of a given collection are in this Set.
@param {Iterable.
copy ()
→ Set <T >
Makes a shallow copy of this Set.
The values are not copied,
so if they are objects they may continue to be shared with the original Set.
@expose
@return {Set.
delete (T val )
→ bool
Removes a value (if found) from the Set.
each (void func (T ) )
→ Set <T >
Call the given function on each item in the collection.
@expose
@param {function(T)} func This function must not modify the collection.
@return {Set.
filter (bool pred (T ) )
→ Set <T >
Call the given predicate on each item in the collection and for each item that it returns true, collect the item in a new Set.
first ()
→ T?
Returns the first item in the collection, or null if there is none.
@return {T|null} This returns null if there are no items in the collection.
has (T val )
→ bool
Returns whether the given value is in this Set.
@param {T} val The value to check.
@return {boolean} Whether or not the value is contained within the Set.
map <S > (S func (T ) )
→ Set <S >
Call the given function on each item in the collection and collect the results in a new Set.
remove (T val )
→ bool
Removes a value (if found) from the Set.
removeAll (Object coll )
→ Set <T >
Removes all of the values of a collection from this Set.
retainAll (Iterable <T > coll )
→ Set <T >
Removes from this Set all items that are not in the given collection.
toArray ()
→ Array <T >
Produces a JavaScript Array from the contents of this Set.
@return {Array.
toList ()
→ List <T >
Converts the Set to a List.
Because there is no ordering within a Set,
the values in the List may be in any order.
@return {List.
toString$ ()
→ String
@return {string}