LinkedStack

LinkedStack

A stack based on a linked list.  It’s basically a wrapper class for a linked list to provide LIFO-like access.

See Also

ArrayedStack

Summary
LinkedStackA stack based on a linked list.
Functions
LinkedStackInitializes a new stack.
peekIndicates the top item.
pushPushes data onto the stack.
popPops data off the stack.
contains@inheritDoc
clear@inheritDoc
getIterator@inheritDoc
Properties
size@inheritDoc
Functions
isEmpty@inheritDoc
toArray@inheritDoc
toStringPrints out a string representing the current object.
dumpPrints out all elements (for debug/demo purposes).

Functions

LinkedStack

public function LinkedStack(list: DLinkedList = null)

Initializes a new stack.  You can pass an existing doubly linked list to provide stack-like access.

Parameters

listAn existing list to become the stack. 

peek

public function peek():*

Indicates the top item.

Returns

The top item. 

push

public function push(obj: *):void

Pushes data onto the stack.

Parameters

objThe data to insert. 

pop

public function pop():*

Pops data off the stack.

Returns

A reference to the top item or null if the stack is empty. 

contains

public function contains(obj: *):Boolean

@inheritDoc

clear

public function clear():void

@inheritDoc

getIterator

public function getIterator():Iterator

@inheritDoc

Properties

size

public function get size():int

@inheritDoc

Functions

isEmpty

public function isEmpty():Boolean

@inheritDoc

toArray

public function toArray():Array

@inheritDoc

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

dump

public function dump():String

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

Returns

A human-readable representation of the structure. 

A ‘java-style’ collection interface.
public function LinkedStack(list: DLinkedList = null)
Initializes a new stack.
public function peek():*
Indicates the top item.
public function push(obj: *):void
Pushes data onto the stack.
public function pop():*
Pops data off the stack.
public function contains(obj: *):Boolean
@inheritDoc
public function clear():void
@inheritDoc
public function getIterator():Iterator
@inheritDoc
public function get size():int
@inheritDoc
public function isEmpty():Boolean
@inheritDoc
public function toArray():Array
@inheritDoc
public function toString():String
Prints out a string representing the current object.
public function dump():String
Prints out all elements (for debug/demo purposes).
An arrayed stack.
Close