Legato.Util.HashSet

Implements a map-backed set of strings.

Summary
Legato.Util.HashSetImplements a map-backed set of strings.
Functions
initializeConstructs the set.
sizeReturns: {Integer} Number of the elements in the set.
isEmptyReturns: {Boolean} True if set is empty, false otherwise.
containsChecks if the set contains the value or not.
addAdds the value to the set.
addAllAdds all the elements of the given collection to this set.
removeRemoves the element from the set.
toArrayReturns: {Array(String)} Array of elements contained in this set.
clearClears the set.

Functions

initialize

initialize : function()

Constructs the set.

size

size : function()

Returns: {Integer} Number of the elements in the set.

isEmpty

isEmpty : function()

Returns: {Boolean} True if set is empty, false otherwise.

contains

contains : function(value)

Checks if the set contains the value or not.

Parameters

value{String} element to add to the set.

Returns: {Boolean} True if given value is belongs to this set, false otherwise.

add

add : function(value)

Adds the value to the set.

Parameters

value{String} element to be added to the set.

Returns: {Boolean} True if an element was added to the set, false if it was already a member of the set.

addAll

addAll : function(set)

Adds all the elements of the given collection to this set.

Parameters

setset of string to be added to this set.

Returns: {Boolean} True if new element were added to the set, false otherwise.

remove

remove : function(value)

Removes the element from the set.

Parameters

value{String} value to be removed from the set.

Returns: {Boolean} True if the value was removed from the given set, false if not (i.e. the value was not an element of this set).

toArray

toArray : function()

Returns: {Array(String)} Array of elements contained in this set.  The order is not deterministic.

clear

clear : function()

Clears the set.

initialize : function()
Constructs the set.
size : function()
Returns: {Integer} Number of the elements in the set.
isEmpty : function()
Returns: {Boolean} True if set is empty, false otherwise.
contains : function(value)
Checks if the set contains the value or not.
add : function(value)
Adds the value to the set.
addAll : function(set)
Adds all the elements of the given collection to this set.
remove : function(value)
Removes the element from the set.
toArray : function()
Returns: {Array(String)} Array of elements contained in this set.
clear : function()
Clears the set.