edu.umd.cs.piccolo.util
Class PStack

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.ArrayList
              extended by edu.umd.cs.piccolo.util.PStack
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class PStack
extends ArrayList

PStack this class should be removed when a non thread safe stack is added to the java class libraries.

Version:
1.0
Author:
Jesse Grosjean
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
PStack()
          Creates an empty stack.
 
Method Summary
 Object peek()
          Returns topmost element on the stack, or null if stack is empty.
 Object pop()
          Removes top element on the stack and returns it.
 void push(Object o)
          Pushes the provided object onto the top of the stack.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

PStack

public PStack()
Creates an empty stack.

Method Detail

push

public void push(Object o)
Pushes the provided object onto the top of the stack.

Parameters:
o - object to add to the stack

peek

public Object peek()
Returns topmost element on the stack, or null if stack is empty.

Returns:
topmost element on the stack, or null if empty

pop

public Object pop()
Removes top element on the stack and returns it.

Returns:
topmost element on stack.


Copyright © 1995-2011 Piccolo2D. All Rights Reserved.