Imported copy of the ArrayStack class from
Commons Collections, which was the only direct dependency from Digester.
Warning
- This class is public solely to allow it to be
used from subpackages of org.apache.commons.digester.
It should not be considered part of the public API of Commons Digester.
If you want to use such a class yourself, you should use the one from
Commons Collections directly.
An implementation of the java. API that is based on an
ArrayList instead of a Vector, so it is not
synchronized to protect against multi-threaded access. The implementation
is therefore operates faster in environments where you do not need to
worry about multiple thread contention.
Unlike Stack, ArrayStack accepts null entries.
java.util.Stack
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Ensure serialization compatibility
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | ArrayStack(int
the initial size to use initialSize)Constructs a new empty |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public E | |
| public E | Returns: the n'th item on the stack, zero relativethe number of items down to go n)Returns the n'th item down (zero-relative) from the top of this stack without removing it. |
| public E | |
| public E | Returns: the item just pushedthe item to be added item)Pushes a new item onto the top of this stack. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Ensure serialization compatibility | |
| ArrayStack | back to summary |
|---|---|
| public ArrayStack() Constructs a new empty | |
| ArrayStack | back to summary |
|---|---|
| public ArrayStack(int initialSize) Constructs a new empty
| |
| empty | back to summary |
|---|---|
| public boolean empty() Return
This method exists for compatibility with
| |
| peek | back to summary |
|---|---|
| public E peek() throws EmptyStackException Returns the top item off of this stack without removing it.
| |
| peek | back to summary |
|---|---|
| public E peek(int n) throws EmptyStackException Returns the n'th item down (zero-relative) from the top of this stack without removing it.
| |
| pop | back to summary |
|---|---|
| public E pop() throws EmptyStackException Pops the top item off of this stack and return it.
| |
| push | back to summary |
|---|---|
| public E push(E item) Pushes a new item onto the top of this stack. The pushed item is also
returned. This is equivalent to calling
| |