| Package | as3.collections |
| Class | public class Set |
| Implements | ISet |
The set is basically a wrapper to an internal map instance, where the set's items serve as the map keys.
An exception will be thrown for any trial to add an item that does not match with the type of the internal TypedDictionary instance. In other words, adding items of a consistent type will not cause any exception. See the head section of the TypedDictionary for more information.
Runtime of operationsSee also
| Property | Defined by | ||
|---|---|---|---|
| numItems : uint [read-only]
Returns the size of the collection.
| Set | ||
| Method | Defined by | ||
|---|---|---|---|
|
Set()
Creates a new Set.
| Set | ||
|
addItem(item:*):Boolean
Adds an item to the set.
| Set | ||
|
clear():void
Removes all items from the collection.
| Set | ||
|
getIterator(cursor:uint = 0):IIterator
Returns an iterator over the set items starting at the specified position.
| Set | ||
|
hasItem(item:*):Boolean
Tests, if an item is contained by the set.
| Set | ||
|
removeItem(item:*):Boolean
Removes an item from the set.
| Set | ||
|
toArray():Array
Returns an array of all items in the order of the particular collection.
| Set | ||
|
toString():String
Info
| Set | ||
| _map | property |
protected var _map:IMapThe internal map.
| numItems | property |
numItems:uint [read-only]Returns the size of the collection.
Implementation public function get numItems():uint
| Set | () | constructor |
public function Set()Creates a new Set.
| addItem | () | method |
public function addItem(item:*):BooleanAdds an item to the set.
Trying to add an item twice leaves the set untouched and returns false.
Parametersitem:* — The item.
|
Boolean — true, if the item has been added, else false.
|
UnsupportedTypeException — If the item type does not match
with the type of the internal map.
|
See also
| clear | () | method |
public function clear():voidRemoves all items from the collection.
| getIterator | () | method |
public function getIterator(cursor:uint = 0):IIteratorReturns an iterator over the set items starting at the specified position.
The iterator of the internal map is returned here. Costs and ordering can be found in the Map documentation.
Parameterscursor:uint (default = 0) — The position.
|
IIterator —
The iterator.
|
See also
| hasItem | () | method |
public function hasItem(item:*):BooleanTests, if an item is contained by the set.
Parametersitem:* — The item to test.
|
Boolean — true, if the item is contained, else false.
|
| removeItem | () | method |
public function removeItem(item:*):BooleanRemoves an item from the set.
Trying to remove an item, which is not contained by the set, leaves the set untouched and returns false.
Parametersitem:* — The item to remove.
|
Boolean — true, if the item has been removed.
|
| toArray | () | method |
public function toArray():ArrayReturns an array of all items in the order of the particular collection.
ReturnsArray — The array.
|
| toString | () | method |
public function toString():StringInfo
ReturnsString |