All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class DataStructures.StackLi

java.lang.Object
    |
    +----DataStructures.StackLi

public class StackLi
extends Object
List-based implementation of the stack.


Constructor Index

 o StackLi()
Construct the stack.

Method Index

 o isEmpty()
Test if the stack is logically empty.
 o isFull()
Test if the stack is logically full.
 o main(String[])
 o makeEmpty()
Make the stack logically empty.
 o pop()
Remove the most recently inserted item from the stack.
 o push(Object)
Insert a new item into the stack.
 o top()
Get the most recently inserted item in the stack.
 o topAndPop()
Return and remove the most recently inserted item from the stack.

Constructors

 o StackLi
public StackLi()
Construct the stack.

Methods

 o isFull
public boolean isFull()
Test if the stack is logically full.

Returns:
false always, in this implementation.
 o isEmpty
public boolean isEmpty()
Test if the stack is logically empty.

Returns:
true if empty, false otherwise.
 o makeEmpty
public void makeEmpty()
Make the stack logically empty.

 o top
public Object top()
Get the most recently inserted item in the stack. Does not alter the stack.

Returns:
the most recently inserted item in the stack, or null, if empty.
 o pop
public void pop() throws Underflow
Remove the most recently inserted item from the stack.

Throws: Underflow
if the stack is empty.
 o topAndPop
public Object topAndPop()
Return and remove the most recently inserted item from the stack.

Returns:
the most recently inserted item in the stack, or null, if empty.
 o push
public void push(Object x)
Insert a new item into the stack.

Parameters:
x - the item to insert.
 o main
public static void main(String[] args)

All Packages  Class Hierarchy  This Package  Previous  Next  Index