goog.structs.StringSet
Provided By |
---|
Creates a set of strings.
new StringSet( opt_elements )
Parameters |
|
---|
Instance Methods
this.__iterator__( opt_keys ) → goog.iter.Iterator
goog.iter.Iterator
Returns an iterator that iterates over the elements in the set.
NOTE: creating the iterator copies the whole set so use #forEach
when
possible.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.add( element ) → void
void
Adds a single element to the set.
Parameters |
|
---|
this.addArray( arr ) → void
void
Adds a the elements of an array to this set.
Parameters |
|
---|
this.addSet( stringSet ) → void
void
Adds a the elements of a set to this set.
Parameters |
|
---|
this.clear() → void
void
Removes all elements of the set.
this.clone() → goog.structs.StringSet
goog.structs.StringSet
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.contains( element ) → boolean
boolean
Tells if the set contains the given element.
warning Deprecated | Use |
---|
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.containsArray( arr ) → boolean
boolean
this.delete( element ) → boolean
boolean
Removes a single element from the set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.equals( stringSet ) → boolean
boolean
Tells if this set has the same elements as the given set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.forEach( f, opt_obj ) → void
void
Calls a function for each element in the set.
Parameters |
|
---|
this.getCount() → number
number
Counts the number of elements in the set in linear time. MOE:begin_strip NOTE: getCount is always called at most once per set instance in google3. MOE:end_strip If this usage pattern won't change, the linear getCount implementation is better, because
- populating a set and getting the number of elements in it takes the same amount of time as keeping a count_ member up to date and getting its value;
- if getCount is not called, adding and removing elements have no overhead.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getDifference( stringSet ) → goog.structs.StringSet
goog.structs.StringSet
Calculates the difference of two sets.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.getIntersection( stringSet ) → goog.structs.StringSet
goog.structs.StringSet
Calculates the intersection of this set with another set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.getSymmetricDifference( stringSet ) → goog.structs.StringSet
goog.structs.StringSet
Calculates the symmetric difference of two sets.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.getUnion( stringSet ) → goog.structs.StringSet
goog.structs.StringSet
Calculates the union of this set and another set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.has( element ) → boolean
boolean
Tells if the set contains the given element.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.isDisjoint( stringSet ) → boolean
boolean
Tells if this set and the given set are disjoint.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.isEmpty() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.isSubsetOf( stringSet ) → boolean
boolean
Tells if this set is the subset of the given set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.isSupersetOf( stringSet ) → boolean
boolean
Tells if this set is the superset of the given set.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.remove( element ) → boolean
boolean
Removes a single element from the set.
warning Deprecated | Use |
---|
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.removeArray( arr ) → void
void
Removes all elements of the given array from this set.
Parameters |
|
---|
this.removeSet( stringSet ) → void
void
Removes all elements of the given set from this set.
Parameters |
|
---|