Class StackInfinitePush<T>

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

public class StackInfinitePush<T> extends Object implements StackInterface<T>
  • Constructor Summary

    Constructors
    Constructor
    Description
    StackInfinitePush(int capacity)
     
  • 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
  • Constructor Details

    • StackInfinitePush

      public StackInfinitePush(int capacity)
  • 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>