Packagecom.threerings.util.sets
Classpublic class MapSet
ImplementsSet

A Set that uses a Map for backing store, thus allowing us to build on the various Maps in useful ways.



Public Methods
 MethodDefined by
  
MapSet(source:Map)
MapSet
  
add(o:Object):Boolean
Adds the specified element to the set if it's not already present.
MapSet
  
clear():void
Remove all elements from this set.
MapSet
  
contains(o:Object):Boolean
Returns true if this set contains the specified element.
MapSet
  
forEach(fn:Function):void
Call the specified function, which accepts an element as an argument.
MapSet
  
isEmpty():Boolean
Returns true if this set contains no elements.
MapSet
  
remove(o:Object):Boolean
Removes the specified element from this set if it is present.
MapSet
  
size():int
Retuns the number of elements in this set.
MapSet
  
toArray():Array
Returns all elements in the set in an Array.
MapSet
Constructor detail
MapSet()constructor
public function MapSet(source:Map)Parameters
source:Map
Method detail
add()method
public function add(o:Object):Boolean

Adds the specified element to the set if it's not already present. Returns true if the set did not already contain the specified element.

Parameters
o:Object

Returns
Boolean
clear()method 
public function clear():void

Remove all elements from this set.

contains()method 
public function contains(o:Object):Boolean

Returns true if this set contains the specified element.

Parameters
o:Object

Returns
Boolean
forEach()method 
public function forEach(fn:Function):void

Call the specified function, which accepts an element as an argument. Signature: function (o :Object) :void or function (o :Object) :Boolean If you return a Boolean, you may return true to indicate that you've found what you were looking for, and halt iteration.

Parameters
fn:Function
isEmpty()method 
public function isEmpty():Boolean

Returns true if this set contains no elements.

Returns
Boolean
remove()method 
public function remove(o:Object):Boolean

Removes the specified element from this set if it is present. Returns true if the set contained the specified element.

Parameters
o:Object

Returns
Boolean
size()method 
public function size():int

Retuns the number of elements in this set.

Returns
int
toArray()method 
public function toArray():Array

Returns all elements in the set in an Array. The Array is not a 'view': it can be modified without disturbing the Map from whence it came.

Returns
Array