public class ContextStack<T>
extends java.lang.Object
Constructor and Description |
---|
ContextStack() |
ContextStack(java.util.List<T> stack) |
ContextStack(T item) |
Modifier and Type | Method and Description |
---|---|
ContextStack<T> |
copy()
Return a new stack based with the same contents
|
ContextStack<T> |
copyPop()
Return a new stack with the same contents but pop a value
|
ContextStack<T> |
copyPush(T value)
Return a new stack based with the same contents and one value pushed
|
static <T> ContextStack<T> |
create(T value)
Create a new stack with a single item
|
T |
peek()
Peek at the top value
|
T |
pop()
Pop a value.
|
void |
push(T value)
push a value
|
int |
size()
Return the stack size
|
java.util.List<T> |
stack()
Return a copy of the stack
|
java.lang.String |
toString()
Joins the context stack items with ":"
|
public ContextStack()
public ContextStack(java.util.List<T> stack)
public ContextStack(T item)
public void push(T value)
public T pop()
java.lang.IllegalStateException
- if no values remainpublic T peek()
java.lang.IllegalStateException
- if no values remainpublic ContextStack<T> copy()
public ContextStack<T> copyPush(T value)
public ContextStack<T> copyPop()
public int size()
public static <T> ContextStack<T> create(T value)
public java.util.List<T> stack()
public java.lang.String toString()
toString
in class java.lang.Object