T - the type of elements stored.public final class _Private_RecyclingStack<T>
extends java.lang.Object
implements java.lang.Iterable<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
_Private_RecyclingStack.ElementFactory<T>
Factory for new stack elements.
|
static interface |
_Private_RecyclingStack.Recycler<T> |
| Modifier and Type | Field and Description |
|---|---|
com.amazon.ion.impl._Private_RecyclingStack.$Iterator |
stackIterator |
| Constructor and Description |
|---|
_Private_RecyclingStack(int initialCapacity,
_Private_RecyclingStack.ElementFactory<T> elementFactory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty() |
java.util.ListIterator<T> |
iterator() |
T |
peek() |
T |
pop()
Pops an element from the stack, retaining a reference to the element so that it can be reused the
next time the stack grows to the element's depth.
|
T |
push(_Private_RecyclingStack.Recycler<T> recycler)
Pushes an element onto the top of the stack, instantiating a new element only if the stack has not
previously grown to the new depth.
|
int |
size() |
public com.amazon.ion.impl._Private_RecyclingStack.$Iterator stackIterator
public _Private_RecyclingStack(int initialCapacity,
_Private_RecyclingStack.ElementFactory<T> elementFactory)
initialCapacity - the initial capacity of the underlying collection.elementFactory - the factory used to create a new element on push(Recycler) when the stack has
not previously grown to the new depth.public java.util.ListIterator<T> iterator()
iterator in interface java.lang.Iterable<T>public T push(_Private_RecyclingStack.Recycler<T> recycler)
public T peek()
public T pop()
public boolean isEmpty()
public int size()