|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.tangosol.util.SimpleStack
public class SimpleStack
A LIFO (last in, first out) unbounded stack of objects. A SimpleStack supports the following operations:
add
a new element to the top of the stackremove
and return the element on the top of the stackreturn
the element on the top of the stackThis class is similar to 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.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
SimpleStack() Create a new empty SimpleStack. |
|
SimpleStack(int nCapacity) Create a new empty SimpleStack with the specified initial capacity. |
Method Summary | |
---|---|
java.lang.Object |
peek() Return the object that is currently on top of the stack. |
java.lang.Object |
pop() Remove and return the object that is currently on top of the stack. |
void |
push(java.lang.Object oElement) Add the given object to 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 interface java.util.List |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public SimpleStack()
public SimpleStack(int nCapacity)
nCapacity
- the initial capacity of the underlying list used to store elementsMethod Detail |
---|
public void push(java.lang.Object oElement)
oElement
- the object to place on top of the stackpublic java.lang.Object pop()
public java.lang.Object peek()
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |