Class LinkedListStack


  • public class LinkedListStack
    extends java.lang.Object
    An implementation of a stack as a sequence of nodes.
    • Constructor Summary

      Constructors 
      Constructor Description
      LinkedListStack()
      Constructs an empty stack.
    • Method Summary

      Modifier and Type Method Description
      boolean empty()
      Checks whether this stack is empty.
      java.lang.Object pop()
      Removes the element from the top of the stack.
      void push​(java.lang.Object element)
      Adds an element to the top of the stack.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LinkedListStack

        public LinkedListStack()
        Constructs an empty stack.
    • Method Detail

      • push

        public void push​(java.lang.Object element)
        Adds an element to the top of the stack.
        Parameters:
        element - the element to add
      • pop

        public java.lang.Object pop()
        Removes the element from the top of the stack.
        Returns:
        the removed element
      • empty

        public boolean empty()
        Checks whether this stack is empty.
        Returns:
        true if the stack is empty