Class UnboundedStack

java.lang.Object
  |
  +--UnboundedStack

public class UnboundedStack
extends java.lang.Object
implements StackImpl

This class implements interface StackImpl with a stack represented by a linked list.


Inner Class Summary
private  class UnboundedStack.Node
           
 
Field Summary
private  int count
           
private  UnboundedStack.Node data
           
 
Constructor Summary
UnboundedStack()
           
 
Method Summary
 int pop()
          Pop the stack.
 void push(int val)
          Push an integer onto the stack.
 int size()
          Return the number of elements contained in the stack.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

data

private UnboundedStack.Node data

count

private int count
Constructor Detail

UnboundedStack

public UnboundedStack()
Method Detail

push

public void push(int val)
Push an integer onto the stack.
Specified by:
push in interface StackImpl
Parameters:
val - The integer value pushed onto the stack.

pop

public int pop()
Pop the stack.
Specified by:
pop in interface StackImpl
Returns:
The integer value popped from the stack.

size

public int size()
Return the number of elements contained in the stack.
Specified by:
size in interface StackImpl
Returns:
The number of elements contained in the stack.