Packagede.polygonal.ds
Classpublic class Set
InheritanceSet Inheritance Object
Implements Collection

A set is a collection of values, without any particular order and no repeated values. The value is its own key.



Public Properties
 PropertyDefined By
  size : int
[read-only] The total number of items.
Set
Public Methods
 MethodDefined By
  
Set()
Creates a new empty set.
Set
  
clear():void
Clears all items.
Set
  
contains(obj:*):Boolean
Determines if the collection contains a given item.
Set
  
dump():String
Prints out all elements (for debug/demo purposes).
Set
  
get(obj:*):*
Reads an item from the set.
Set
  
Initializes an iterator object pointing to the first item in the collection.
Set
  
isEmpty():Boolean
Checks if the collection is empty.
Set
  
remove(obj:*):Boolean
Removes an item from the set.
Set
  
set(obj:*):void
Writes an item to the set.
Set
  
toArray():Array
Converts the collection into an array.
Set
  
toString():String
Prints out a string representing the current object.
Set
Property Detail
sizeproperty
size:int  [read-only]

The total number of items.


Implementation
    public function get size():int
Constructor Detail
Set()Constructor
public function Set()

Creates a new empty set.

Method Detail
clear()method
public function clear():void

Clears all items.

contains()method 
public function contains(obj:*):Boolean

Determines if the collection contains a given item.

Parameters

obj:* — The item to search for.

Returns
Boolean — True if the item exists, otherwise false.
dump()method 
public function dump():String

Prints out all elements (for debug/demo purposes).

Returns
String — A human-readable representation of the structure.
get()method 
public function get(obj:*):*

Reads an item from the set.

Parameters

obj:* — The item to retrieve.

Returns
* — The item matching the obj parameter or null if the item is not part of the set.
getIterator()method 
public function getIterator():Iterator

Initializes an iterator object pointing to the first item in the collection.

Returns
Iterator — An iterator object.
isEmpty()method 
public function isEmpty():Boolean

Checks if the collection is empty.

Returns
Boolean — True if empty, otherwise false.
remove()method 
public function remove(obj:*):Boolean

Removes an item from the set.

Parameters

obj:* — The item to remove

Returns
Boolean — The removed item or null if the item wasn't contained by the set.
set()method 
public function set(obj:*):void

Writes an item to the set.

Parameters

obj:* — The item to be added to the set.

toArray()method 
public function toArray():Array

Converts the collection into an array.

Returns
Array — An array.
toString()method 
public function toString():String

Prints out a string representing the current object.

Returns
String — A string representing the current object.