Package com.tangosol.util
Class SimpleStack
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.tangosol.util.SimpleStack
- All Implemented Interfaces:
 Serializable,Cloneable,Iterable,Collection,List,RandomAccess,SequencedCollection
A LIFO (last in, first out) unbounded stack of objects. A SimpleStack supports
 the following operations:
 
adda new element to the top of the stackremoveand return the element on the top of the stackreturnthe element on the top of the stack
Stack except that it extends
 ArrayList rather than Vector and is
 therefore not thread safe. The top of the stack corresponds to the last
 element in the underlying list, whereas the bottom corresponds to the first.
 
 The SimpleStack implementation supports null elements; however, if null
 elements are added, care must be taken to distinguish a null element returned
 from pop() or peek() from a null value that indicates the
 stack is empty.
- Since:
 - Coherence 3.2
 - Author:
 - jh 2006.05.04
 - See Also:
 
- 
Field Summary
Fields inherited from class java.util.AbstractList
modCount - 
Constructor Summary
ConstructorsConstructorDescriptionCreate a new empty SimpleStack.SimpleStack(int nCapacity) Create a new empty SimpleStack with the specified initial capacity. - 
Method Summary
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed 
- 
Constructor Details
- 
SimpleStack
public SimpleStack()Create a new empty SimpleStack. - 
SimpleStack
public SimpleStack(int nCapacity) Create a new empty SimpleStack with the specified initial capacity.- Parameters:
 nCapacity- the initial capacity of the underlying list used to store elements
 
 - 
 - 
Method Details
- 
push
Add the given object to the top of the stack.- Parameters:
 oElement- the object to place on top of the stack
 - 
pop
Remove and return the object that is currently on top of the stack.- Returns:
 - the object removed from the top of the stack or null if the stack is empty
 
 - 
peek
Return the object that is currently on top of the stack.- Returns:
 - the object on top of the stack or null if the stack is empty
 
 
 -