    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class DataStructures.StackLi

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

public class StackLi
extends Object
implements Stack

List-based implementation of the stack.

##

StackLi()
  Construct the stack.

##

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

##

StackLi

    public StackLi()

  Construct the stack.

##

isEmpty

    public boolean isEmpty()

  Test if the stack is logically empty.

  Returns:
    true if empty, false otherwise.

makeEmpty

    public void makeEmpty()

  Make the stack logically empty.

top

    public Object top() throws Underflow

  Get the most recently inserted item in the stack. Does not alter the stack.

  Returns:
    the most recently inserted item in the stack.
  Throws: Underflow
    if the stack is empty.

pop

    public void pop() throws Underflow

  Remove the most recently inserted item from the stack.

  Throws: Underflow
    if the stack is empty.

topAndPop

    public Object topAndPop() throws Underflow

  Return and remove the most recently inserted item from the stack.

  Returns:
    the most recently inserted item in the stack.
  Throws: Underflow
    if the stack is empty.

push

    public void push(Object x)

  Insert a new item into the stack.

  Parameters:
    x - the item to insert.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index