Class: Stack

Stack

new javascript.util.Stack()

Stack.js, line 20
See:

Extends

Members

add

Ensures that this collection contains the specified element (optional operation).

addAll

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

privatearray_Array

get

Returns the element at the specified position in this list.

iterator

Returns an iterator over the elements in this collection.

remove

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

set

Replaces the element at the specified position in this list with the specified element (optional operation).

Methods

empty(){boolean}

Stack.js, line 81

Tests if this stack is empty.

Returns:
Type Description
boolean true if and only if this stack contains no items; false otherwise.

isEmpty(){boolean}

Stack.js, line 94
Returns:
Type Description
boolean

peek(){Object}

Stack.js, line 66

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

Returns:
Type Description
Object

pop(e){Object}

Stack.js, line 51

Pushes an item onto the top of this stack.

Name Type Description
e Object
Returns:
Type Description
Object

push(e){Object}

Stack.js, line 39

Pushes an item onto the top of this stack.

Name Type Description
e Object
Returns:
Type Description
Object
Stack.js, line 114

Returns the 1-based position where an object is on this stack. If the object o occurs as an item in this stack, this method returns the distance from the top of the stack of the occurrence nearest the top of the stack; the topmost item on the stack is considered to be at distance 1. The equals method is used to compare o to the items in this stack.

NOTE: does not currently actually use equals. (=== is used)

Name Type Description
o Object
Returns:
Type Description
number the 1-based position from the top of the stack where the object is located; the return value -1 indicates that the object is not on the stack.

size(){number}

Stack.js, line 123
Returns:
Type Description
number

toArray(){Array}

Stack.js, line 132
Returns:
Type Description
Array