Class StandardStack<T>
java.lang.Object
org.hibernate.internal.util.collections.StandardStack<T>
- Type Parameters:
T- The type of things stored in the stack
- All Implemented Interfaces:
Stack<T>
A general-purpose stack impl supporting null values.
-
Constructor Summary
ConstructorsConstructorDescriptionStandardStack(Class<T> type) Deprecated, for removal: This API element is subject to removal in a future version.use the default constructor insteadStandardStack(Class<T> type, T initial) Deprecated, for removal: This API element is subject to removal in a future version.useStandardStack(Object)instead.StandardStack(T initialValue) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all elements from the stackintdepth()How many elements are currently on the stack?<X> XfindCurrentFirst(Function<T, X> function) Find an element on the stack and return a value.<X,Y> X findCurrentFirstWithParameter(Y parameter, BiFunction<T, Y, X> biFunction) Runs a function on each couple defined as {Y,T} in which Y is fixed, and T is each instance of this stack.The element currently at the top of the stackgetRoot()The element currently at the bottom of the stackbooleanisEmpty()Are there no elements currently in the stack?peek(int offsetFromTop) The element at the given offset, relative to the top of the stackpop()Pop (remove and return) the current element off the stackvoidPush the new element on the top of the stackvoidvisitRootFirst(Consumer<T> action) Visit all elements in the stack, starting with the root and working "forward"
-
Constructor Details
-
StandardStack
public StandardStack() -
StandardStack
-
StandardStack
Deprecated, for removal: This API element is subject to removal in a future version.use the default constructor instead -
StandardStack
Deprecated, for removal: This API element is subject to removal in a future version.useStandardStack(Object)instead.
-
-
Method Details
-
push
Description copied from interface:StackPush the new element on the top of the stack -
pop
Description copied from interface:StackPop (remove and return) the current element off the stack -
getCurrent
Description copied from interface:StackThe element currently at the top of the stack- Specified by:
getCurrentin interfaceStack<T>
-
peek
Description copied from interface:StackThe element at the given offset, relative to the top of the stack -
getRoot
Description copied from interface:StackThe element currently at the bottom of the stack -
depth
public int depth()Description copied from interface:StackHow many elements are currently on the stack? -
isEmpty
public boolean isEmpty()Description copied from interface:StackAre there no elements currently in the stack? -
clear
public void clear()Description copied from interface:StackRemove all elements from the stack -
visitRootFirst
Description copied from interface:StackVisit all elements in the stack, starting with the root and working "forward"- Specified by:
visitRootFirstin interfaceStack<T>
-
findCurrentFirst
Description copied from interface:StackFind an element on the stack and return a value. The first non-null element returned from `action` stops the iteration and is returned from here- Specified by:
findCurrentFirstin interfaceStack<T>
-
findCurrentFirstWithParameter
Description copied from interface:StackRuns a function on each couple defined as {Y,T} in which Y is fixed, and T is each instance of this stack. Not all Ts might be presented as the iteration is interrupted as soon as the first non-null value is returned by the (bi)function, which is then returned from this function.- Specified by:
findCurrentFirstWithParameterin interfaceStack<T>- Type Parameters:
X- the return type of the functionY- the type of the fixed parameter- Parameters:
parameter- a parameter to be passed to the (bi)funtionbiFunction- a (bi)function taking as input parameter Y and each of the T from the current stack, and return type of X.- Returns:
- the first non-null result by the function, or null if no matches.
-