previous | start | next

Method Documentation

/**
 * The Stack class represents a last-in, first-out data type.
 * 
 * @author glancast 
 */
public class Stack<E>
{
  /**
   * Creates an empty Stack
   *
   */
  public Stack()
  {}

  /**
   * Inserts an item on the top of this Stack.
   *
   * @param x the item to be inserted
   */
  public void push(E x)
  {}
  
  /**
   * Removes the last inserted item on the stack
   * and returns that object as the return value of
   * this method.
   *
   * @return The item removed from the top of the stack.
   * @throws NoSuchElementException if the stack is empty.
   */
  public E pop()
  {}
  
  /**
   * Returns the last inserted item on the the stack without 
   * removing it.
   *
   * @return The item at the top of the stack.
   * @throws NoSuchElementException if the stack is empty.
   */
  public E peek()
  {}
  
  /**
   * Test if this stack is empty.
   * @return true if the stack is empty; false, otherwise.
   */
  public boolean isEmpty()
  {}

  /**
   * Get the number of elements in this stack.
   *
   * @return the number of elements
   */
  public int size()
  {}
}


previous | start | next