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
-
Constructor Details
-
LinkedListStack
public LinkedListStack()
-
-
Method Details
-
push
Pushes (adds) an element to the top of the stack.- Parameters:
element- The element to be added.
-
pop
Pops (removes and returns) the top of the stack.- Returns:
- The top element on the stack.
-
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:
Trueif there are elements in the stack, otherwisefalse.
-
size
public int size()- Returns:
- the number of elements in this stack.
-