public class LinkedStack<E> extends Object implements Stack<E>
SinglyLinkedList
Constructor and Description |
---|
LinkedStack()
Constructs an initially empty stack.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Tests whether the stack is empty.
|
E |
pop()
Removes and returns the top element from the stack.
|
void |
push(E element)
Inserts an element at the top of the stack.
|
int |
size()
Returns the number of elements in the stack.
|
E |
top()
Returns, but does not remove, the element at the top of the stack.
|
String |
toString()
Produces a string representation of the contents of the stack.
|
public int size()
public boolean isEmpty()
public void push(E element)
public E top()
public E pop()