Class ArrayStringStack

java.lang.Object
ch.hslu.exercises.sw02.ex3.ArrayStringStack
All Implemented Interfaces:
Stack<String>

public final class ArrayStringStack extends Object implements Stack<String>
  • Constructor Details

    • ArrayStringStack

      public ArrayStringStack(int size)
  • Method Details

    • size

      public int size()
      Description copied from interface: Stack
      Get the size of the Stack.
      Specified by:
      size in interface Stack<String>
      Returns:
      the size of the Stack
    • peek

      public String peek()
      Description copied from interface: Stack
      Take a look the top element without removing it.
      Specified by:
      peek in interface Stack<String>
      Returns:
      the top element of the Stack
    • pop

      public String pop()
      Description copied from interface: Stack
      Take the top element from the stack.
      Specified by:
      pop in interface Stack<String>
      Returns:
      the top element of the stack
    • push

      public void push(String element)
      Description copied from interface: Stack
      Pushes an element on top of the stack.
      Specified by:
      push in interface Stack<String>
      Parameters:
      element - to be pushed to the stack
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Stack
      Checks if the stack is empty.
      Specified by:
      isEmpty in interface Stack<String>
      Returns:
      true if empty and false if not
    • isFull

      public boolean isFull()
      Description copied from interface: Stack
      Checks if the Stack is full.
      Specified by:
      isFull in interface Stack<String>
      Returns:
      True if no element can be added anymore.