goog.structs.StringSet
Classgoog.structs.StringSet(opt_elements)
Creates a set of strings.
opt_elements
{!Array
=}
.__iterator__(opt_keys)
Returns an iterator that iterates over the elements in the set. NOTE: creating the iterator copies the whole set so use {@link #forEach} when possible.
opt_keys
{boolean
=}
goog.iter.Iterator
}
.add(element)
Adds a single element to the set.
element
{*}
.addArray(arr)
Adds a the elements of an array to this set.
arr
{!Array
}
.addSet(stringSet)
Adds a the elements of a set to this set.
stringSet
{!goog.structs.StringSet
}
.clear()
Removes all elements of the set.
.clone()
goog.structs.StringSet
}
.contains(element)
Tells if the set contains the given element.
element
{*}
boolean
}
.containsArray(arr)
Tells if the set contains all elements of the array.
arr
{!Array
}
boolean
}
.decode(key)
[protected]Inverse function of {@link #encode}. NOTE: forEach would be 30% faster in FF if the compiler inlined decode.
key
{string
}
string
}
.encode(element)
[protected]The '__proto__' and the '__count__' keys aren't enumerable in Firefox, and 'toString', 'valueOf', 'constructor', etc. aren't enumerable in IE so they have to be escaped before they are added to the internal object. NOTE: When a new set is created, 50-80% of the CPU time is spent in encode.
element
{*}
.equals(stringSet)
Tells if this set has the same elements as the given set.
stringSet
{!goog.structs.StringSet
}
boolean
}
.forEach(f, opt_obj)
Calls a function for each element in the set.
f
{function
(string
, undefined
, !goog.structs.StringSet
)}
opt_obj
{Object
=}
.getCount()
Counts the number of elements in the set in linear time. NOTE: getCount is always called at most once per set instance in google3. If this usage pattern won't change, the linear getCount implementation is better, because
number
}
.getDifference(stringSet)
Calculates the difference of two sets.
stringSet
{!goog.structs.StringSet
}
goog.structs.StringSet
}
.getIntersection(stringSet)
Calculates the intersection of this set with another set.
stringSet
{!goog.structs.StringSet
}
goog.structs.StringSet
}
.getSymmetricDifference(stringSet)
Calculates the symmetric difference of two sets.
stringSet
{!goog.structs.StringSet
}
goog.structs.StringSet
}
.getUnion(stringSet)
Calculates the union of this set and another set.
stringSet
{!goog.structs.StringSet
}
goog.structs.StringSet
}
.getValues()
Array
.<string
>}
.isDisjoint(stringSet)
Tells if this set and the given set are disjoint.
stringSet
{!goog.structs.StringSet
}
boolean
}
.isEmpty()
boolean
}
.isSubsetOf(stringSet)
Tells if this set is the subset of the given set.
stringSet
{!goog.structs.StringSet
}
boolean
}
.isSupersetOf(stringSet)
Tells if this set is the superset of the given set.
stringSet
{!goog.structs.StringSet
}
boolean
}
.remove(element)
Removes a single element from the set.
element
{*}
boolean
}
.removeArray(arr)
Removes all elements of the given array from this set.
arr
{!Array
}
.removeSet(stringSet)
Removes all elements of the given set from this set.
stringSet
{!goog.structs.StringSet
}