Class ArrayStackBottomAtEnd<T>

java.lang.Object
ArrayStackBottomAtEnd<T>
All Implemented Interfaces:
StackInterface<T>

public class ArrayStackBottomAtEnd<T> extends Object implements StackInterface<T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all entries from the stack.
    boolean
    Determines if there are any elements in the stack.
    Get this stack's top entry.
    pop()
    Removes and returns this stack's top entry.
    void
    push(T newEntry)
    Adds a new entry to the top of this stack.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_INITIAL_CAPACITY

      public static final int DEFAULT_INITIAL_CAPACITY
      See Also:
  • Constructor Details

    • ArrayStackBottomAtEnd

      public ArrayStackBottomAtEnd()
  • Method Details

    • push

      public void push(T newEntry)
      Description copied from interface: StackInterface
      Adds a new entry to the top of this stack.
      Specified by:
      push in interface StackInterface<T>
      Parameters:
      newEntry - element to be added to the stack
    • pop

      public T pop()
      Description copied from interface: StackInterface
      Removes and returns this stack's top entry. The size of the stack is decreased by one.
      Specified by:
      pop in interface StackInterface<T>
      Returns:
      The element at the top of the stack.
    • peek

      public T peek()
      Description copied from interface: StackInterface
      Get this stack's top entry. The size of the stack is not changed.
      Specified by:
      peek in interface StackInterface<T>
      Returns:
      The element at the top of the stack.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: StackInterface
      Determines if there are any elements in the stack.
      Specified by:
      isEmpty in interface StackInterface<T>
      Returns:
      True if the stack is empty.
    • clear

      public void clear()
      Description copied from interface: StackInterface
      Removes all entries from the stack.
      Specified by:
      clear in interface StackInterface<T>