jdsl.simple.ref
Class LinkedStack
java.lang.Object
|
+--jdsl.simple.ref.LinkedStack
- public class LinkedStack
- extends java.lang.Object
- implements Stack
Implementation of a stack by means of a linked list. The nodes of the
linked list are represented by class Node which stores a reference to
its element and the next node in the list.
- Author:
- Natasha Gelfand
|
Method Summary |
boolean |
isEmpty()
|
java.lang.Object |
pop()
|
void |
push(java.lang.Object obj)
|
int |
size()
|
java.lang.Object |
top()
|
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
LinkedStack
public LinkedStack()
size
public int size()
- Specified by:
- size in interface Stack
isEmpty
public boolean isEmpty()
- Specified by:
- isEmpty in interface Stack
push
public void push(java.lang.Object obj)
- Specified by:
- push in interface Stack
top
public java.lang.Object top()
throws StackEmptyException
- Specified by:
- top in interface Stack
pop
public java.lang.Object pop()
throws StackEmptyException
- Specified by:
- pop in interface Stack