public class Stack
extends java.lang.Object
Constructor and Description |
---|
Stack(int size)
Creates a new stack
|
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Checks to see if the stack is empty
|
boolean |
isFull()
Checks to see if the stack is full
|
Node |
peek()
Gets the top item from the stack without removing it.
|
Node |
pop()
Removes the top node from the stack
|
void |
push(Node n)
Adds a node to the stack if it is not full
|
public Stack(int size)
size
- the size of the stack implemented as an arraypublic void push(Node n)
n
- the node to be added to the stackpublic Node pop()
public boolean isEmpty()
public boolean isFull()
public Node peek()