Packagecom.yworks.support
Classpublic class HashSet
InheritanceHashSet Inheritance Object
Implements Collection

A Collection that obeys the 'set' semantics.

An item can only be contained once in the same set. This implementation is based on hash values and equality checks.



Public Methods
 MethodDefined By
  
HashSet(values:Iterable = null)
Creates a new hashset using the given values to initialize the set, or an empty hashset if no values are passed.
HashSet
  
addAll(iter:Iterable):void
Adds a collection of elements to this set.
HashSet
  
addItem(item:Object):Boolean
Adds the given item to this set.
HashSet
  
clear():void
Removes all of the elements from this collection.
HashSet
  
contains(item:Object):Boolean
Returns true if this collection contains the specified element.
HashSet
  
getItemAt(index:int):Object
Not supported.
HashSet
  
isEmpty():Boolean
Returns true if this collection contains no elements.
HashSet
  
Returns an iterator over a set of elements.
HashSet
  
length():uint
Returns the number of elements in this collection.
HashSet
  
removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation).
HashSet
  
toArray():Array
Returns an array containing all of the elements in this collection.
HashSet
Constructor Detail
HashSet()Constructor
public function HashSet(values:Iterable = null)

Creates a new hashset using the given values to initialize the set, or an empty hashset if no values are passed.

Parameters
values:Iterable (default = null)
Method Detail
addAll()method
public function addAll(iter:Iterable):void

Adds a collection of elements to this set.

Parameters

iter:Iterable

addItem()method 
public function addItem(item:Object):Boolean

Adds the given item to this set.

If the item is already contained in this set, it will not be added.

Parameters

item:Object — The item to add.

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

Removes all of the elements from this collection. The collection will be empty after this method returns.

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

Returns true if this collection contains the specified element.

Parameters

item:Object — element whose presence in this collection is to be tested

Returns
Boolean — true if this collection contains the specified element
getItemAt()method 
public function getItemAt(index:int):Object

Not supported.

Parameters

index:int

Returns
Object
isEmpty()method 
public function isEmpty():Boolean

Returns true if this collection contains no elements.

Returns
Boolean — true if this collection contains no elements
iterator()method 
public function iterator():Iterator

Returns an iterator over a set of elements.

Returns
Iterator — an Iterator.
length()method 
public function length():uint

Returns the number of elements in this collection.

Returns
uint — the number of elements in this collection
removeItem()method 
public function removeItem(item:Object):Boolean

Removes a single instance of the specified element from this collection, if it is present (optional operation).

Parameters

item:Object — element to be removed from this collection, if present

Returns
Boolean — true if an element was removed as a result of this call
toArray()method 
public function toArray():Array

Returns an array containing all of the elements in this collection.

Returns
Array — an array containing all of the elements in this collection