Interface IStack<T>

All Known Implementing Classes:
FixedStack

public interface IStack<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the stack
    boolean
    Tests if stack is empty
    Check element on top of the stack
    pop()
    Removes the object at the top of this stack and returns that object as the value
    void
    push(T element)
    Pushes an item onto the top of this stack
    int
    Returns the number of items in this stack
    T[]
    toArray(Class<T[]> type)
    Converts stack into the array, ordered by the push order (the latest items are the first in array)
  • Method Details

    • push

      void push(T element)
      Pushes an item onto the top of this stack
      Parameters:
      element - the item to be pushed onto this stack
    • peek

      T peek()
      Check element on top of the stack
      Returns:
      the value on top
    • pop

      T pop()
      Removes the object at the top of this stack and returns that object as the value
      Returns:
      the object at the top of this stack
    • clear

      void clear()
      Clear the stack
    • size

      int size()
      Returns the number of items in this stack
      Returns:
      the number of items
    • isEmpty

      boolean isEmpty()
      Tests if stack is empty
      Returns:
      true if and only if this stack contains no items
    • toArray

      T[] toArray(Class<T[]> type)
      Converts stack into the array, ordered by the push order (the latest items are the first in array)
      Returns:
      the array of items from stack