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 Object
Custom implementation of a stack that uses a linked list functionality approach.- Author:
- Collin Alpert
- See Also:
LinkedListStack.Node
-
-
Method Detail
-
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:
Trueif there are elements in the stack, otherwisefalse.
-
size
public int size()
- Returns:
- the number of elements in this stack.
-
-