Constructor and Description |
---|
ListStack()
Creates a linked list representing an empty stack.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Reports whether the stack is currently empty without changing it.
|
E |
peek()
Reports the top element of the stack without changing it.
|
E |
pop()
Removes an element from the top of the stack and reports it.
|
void |
push(E x)
Pushes a new entry onto the stack.
|
public void push(E x)
Stack
push
in interface Stack<E>
x
- the object to be pushed onto the stack
public E peek()
Stack
public E pop()
Stack
public boolean isEmpty()
Stack
isEmpty
in interface Stack<E>