Class LinkedListStack<T>

java.lang.Object
com.github.collinalpert.lambda2sql.LinkedListStack<T>
Type Parameters:
T - The type of the Stack.

public class LinkedListStack<T>
extends java.lang.Object
Custom implementation of a stack that uses a linked list functionality approach.
Author:
Collin Alpert
See Also:
LinkedListStack.Node
  • Constructor Summary

    Constructors 
    Constructor Description
    LinkedListStack()  
  • Method Summary

    Modifier and Type Method Description
    boolean isEmpty()
    Checks if the stack is empty.
    T pop()
    Pops (removes and returns) the top of the stack.
    void push​(T element)
    Pushes (adds) an element to the top of the stack.
    int size()  
    T top()
    Returns the top of the stack.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • push

      public void push​(T element)
      Pushes (adds) an element to the top of the stack.
      Parameters:
      element - The element to be added.
    • pop

      public T pop()
      Pops (removes and returns) the top of the stack.
      Returns:
      The top element on the stack.
    • top

      public T top()
      Returns the top of the stack.
      Returns:
      The first element on the stack.
    • isEmpty

      public boolean isEmpty()
      Checks if the stack is empty.
      Returns:
      True if there are elements in the stack, otherwise false.
    • size

      public int size()
      Returns:
      the number of elements in this stack.