goog.structs.Set<T>
Provided By | |
---|---|
All Implemented Interfaces |
warning Deprecated | This type is misleading: use ES6 Set instead. |
---|
A set that can contain both primitives and objects. Adding and removing elements is O(1). Primitives are treated as identical if they have the same type and convert to the same string. Objects are treated as identical only if they are references to the same object. WARNING: A goog.structs.Set can contain both 1 and (new Number(1)), because they are not the same. WARNING: Adding (new Number(1)) twice will yield two distinct elements, because they are two different objects. WARNING: Any object that is added to a goog.structs.Set will be modified! Because goog.getUid() is used to identify objects, every object in the set will be mutated.
new Set<T>( opt_values )
Parameters |
|
---|
Instance Methods
this.__iterator__( opt_keys ) → goog.iter.Iterator
goog.iter.Iterator
Returns an iterator that iterates over the elements in this set.
warning Deprecated | Call |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.add( element ) → void
void
Add a primitive or an object to the set.
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
|
this.addAll( col ) → void
void
Adds all the values in the given collection to this set.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
|
this.clear() → void
void
this.clone() → goog.structs.Set<(T|null)>
goog.structs.Set<(T|null)>
Creates a shallow clone of this set.
warning Deprecated | Use |
---|
Overrides | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.contains( element ) → boolean
boolean
Tests whether this set contains the given element.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.containsAll( col ) → boolean
boolean
Tests whether this set contains all the values in a given collection. Repeated elements in the collection are ignored, e.g. (new goog.structs.Set([1, 2])).containsAll([1, 1]) is True.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.delete( element ) → boolean
boolean
Removes the given element from this set.
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.difference( col ) → goog.structs.Set
goog.structs.Set
Finds all values that are present in this set and not in the given collection.
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.equals( col ) → boolean
boolean
Tests whether the given collection consists of the same elements as this set, regardless of order, without repetition. Primitives are treated as equal if they have the same type and convert to the same string; objects are treated as equal if they are references to the same object. This operation is O(n).
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.getCount() → number
number
warning Deprecated | Use the |
---|
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.getValues() → Array<(T|null)>
Array<(T|null)>
Returns an array containing all the elements in this set.
warning Deprecated | Use |
---|
Overrides | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.has( element ) → boolean
boolean
Tests whether this set contains the given element.
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.intersection<S>( col ) → goog.structs.Set<(T|null)>
goog.structs.Set<(T|null)>
Finds all values that are present in both this set and the given collection.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.isEmpty() → boolean
boolean
Tests whether this set is empty.
warning Deprecated | Use the size property and compare against 0, for alignment with ES6 Set. |
---|
Overrides | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.isSubsetOf( col ) → boolean
boolean
Tests whether the given collection contains all the elements in this set. Primitives are treated as equal if they have the same type and convert to the same string; objects are treated as equal if they are references to the same object. This operation is O(n).
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.remove( element ) → boolean
boolean
Removes the given element from this set.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.removeAll( col ) → void
void
Removes all values in the given collection from this set.
warning Deprecated | Use |
---|
Overrides | |||||
---|---|---|---|---|---|
Parameters |
|
this.values() → IteratorIterable<(T|null)>
IteratorIterable<(T|null)>
Overrides | ||
---|---|---|
Parameters | None. | |
Returns |
|
Instance Properties
this.map_ → goog.structs.Map<?, ?>
goog.structs.Map<?, ?>
No information.
this.size → number
number