Packagesystem.data.stacks
Classpublic class ArrayStack
InheritanceArrayStack Inheritance ArrayCollection Inheritance Object
Implements Stack

The based implementation of the Stack interface. The Stack interface represents a last-in-first-out (LIFO) stack of objects.
     import system.data.stacks.ArrayStack ;
     
     var stack:ArrayStack = new ArrayStack(["item1", "item2"]) ;
     
     stack.push("item3") ;
     
     trace("toSource : " + stack.toSource()) ;
     trace("pop      : " + stack.pop()) ;
     trace("stack    : " + stack) ;
     



Public Methods
 MethodDefined By
  
ArrayStack(init:* = null)
Creates a new SimpleStack instance.
ArrayStack
 Inherited
add(o:*):Boolean
Inserts an element in the collection.
ArrayCollection
 Inherited
addAll(c:Collection):Boolean
Appends all of the elements in the specified collection to the end of this Collection, in the order that they are returned by the specified collection's iterator (optional operation).
ArrayCollection
 Inherited
clear():void
Removes all elements in the collection.
ArrayCollection
  
clone():*
[override] Returns a shallow copy of this object.
ArrayStack
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified element.
ArrayCollection
 Inherited
Returns true if this collection contains all of the elements of the specified collection.
ArrayCollection
 Inherited
equals(o:*):Boolean
Compares the specified object with this object for equality.
ArrayCollection
 Inherited
get(key:*):*
Returns the element from this collection at the passed key index.
ArrayCollection
 Inherited
indexOf(o:*, fromIndex:uint = 0):int
Returns the index of an element in the collection.
ArrayCollection
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
ArrayCollection
 Inherited
Returns the iterator reference of the object.
ArrayCollection
  
peek():*
Looks at the object at the top of this stack without removing it from the stack.
ArrayStack
  
pop():*
Removes the object at the top of this stack and returns that object as the value of this function.
ArrayStack
  
push(o:*):void
Pushes an item into the top of this stack.
ArrayStack
 Inherited
remove(o:*):*
Removes a single instance of the specified element from this collection, if it is present (optional operation).
ArrayCollection
 Inherited
Removes from this Collection all the elements that are contained in the specified Collection (optional operation).
ArrayCollection
 Inherited
Retains only the elements in this Collection that are contained in the specified Collection (optional operation).
ArrayCollection
  
search(o:*):int
Returns the index of an element in the Stack.
ArrayStack
 Inherited
size():uint
Returns the number of elements in this collection.
ArrayCollection
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
ArrayCollection
 Inherited
toSource(indent:int = 0):String
Returns the source code string representation of the object.
ArrayCollection
 Inherited
toString():String
Returns the string representation of this instance.
ArrayCollection
Constructor Detail
ArrayStack()Constructor
public function ArrayStack(init:* = null)

Creates a new SimpleStack instance.

Parameters
init:* (default = null) — An optional Array or Collection to fill the collection.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this object.

Returns
* — a shallow copy of this object.
peek()method 
public function peek():*

Looks at the object at the top of this stack without removing it from the stack.

Returns
*
pop()method 
public function pop():*

Removes the object at the top of this stack and returns that object as the value of this function.

Returns
* — the removed object value.
push()method 
public function push(o:*):void

Pushes an item into the top of this stack.

Parameters

o:*

search()method 
public function search(o:*):int

Returns the index of an element in the Stack.

Parameters

o:*

Returns
int — the index of an element in the Stack.