Class ContextStack<T>
- java.lang.Object
-
- com.dtolabs.rundeck.core.execution.workflow.ContextStack<T>
-
public class ContextStack<T> extends java.lang.Object
A simple stack, with factory methods for making mutated copies
-
-
Constructor Summary
Constructors Constructor Description ContextStack()
ContextStack(java.util.List<T> stack)
ContextStack(T item)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ContextStack<T>
copy()
Return a new stack based with the same contentsContextStack<T>
copyPop()
Return a new stack with the same contents but pop a valueContextStack<T>
copyPush(T value)
Return a new stack based with the same contents and one value pushedstatic <T> ContextStack<T>
create(T value)
Create a new stack with a single itemT
peek()
Peek at the top valueT
pop()
Pop a value.void
push(T value)
push a valueint
size()
Return the stack sizejava.util.List<T>
stack()
Return a copy of the stackjava.lang.String
toString()
Joins the context stack items with ":"
-
-
-
Method Detail
-
push
public void push(T value)
push a value
-
pop
public T pop()
Pop a value.- Throws:
java.lang.IllegalStateException
- if no values remain
-
peek
public T peek()
Peek at the top value- Throws:
java.lang.IllegalStateException
- if no values remain
-
copy
public ContextStack<T> copy()
Return a new stack based with the same contents
-
copyPush
public ContextStack<T> copyPush(T value)
Return a new stack based with the same contents and one value pushed
-
copyPop
public ContextStack<T> copyPop()
Return a new stack with the same contents but pop a value
-
size
public int size()
Return the stack size
-
create
public static <T> ContextStack<T> create(T value)
Create a new stack with a single item
-
stack
public java.util.List<T> stack()
Return a copy of the stack
-
toString
public java.lang.String toString()
Joins the context stack items with ":"- Overrides:
toString
in classjava.lang.Object
-
-