Top Description Methods
org.hibernate.internal.util.collections

public Interface Stack<T>

Known Direct Implementers
org.hibernate.internal.util.collections.StandardStack
Type Parameters
<T>
The type of things stored in the stack
Imports
java.util.function.BiFunction, .Consumer, .Function, org.hibernate.Incubating

Stack implementation exposing useful methods for Hibernate needs.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Remove all elements from the stack

public int
depth()

How many elements are currently on the stack?

public <X> X
findCurrentFirst(Function<T, X> action)

Find an element on the stack and return a value.

public <
the return type of the function
X
,
the type of the fixed parameter
Y
>
X

Returns:

the first non-null result by the function, or null if no matches.
findCurrentFirstWithParameter
(Y
a parameter to be passed to the (bi)funtion
parameter
,
BiFunction<T, Y, X>
a (bi)function taking as input parameter Y and each of the T from the current stack, and return type of 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.

public T
getCurrent()

The element currently at the top of the stack

public T
getRoot()

The element currently at the bottom of the stack

public boolean
isEmpty()

Are there no elements currently in the stack?

public T
peek(int offsetFromTop)

The element at the given offset, relative to the top of the stack

public T
pop()

Pop (remove and return) the current element off the stack

public void
push(T newCurrent)

Push the new element on the top of the stack

public void
visitRootFirst(Consumer<T> action)

Visit all elements in the stack, starting with the root and working "forward"

Method Detail

clearback to summary
public void clear()

Remove all elements from the stack

depthback to summary
public int depth()

How many elements are currently on the stack?

findCurrentFirstback to summary
public <X> X findCurrentFirst(Function<T, X> action)

Find 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

findCurrentFirstWithParameterback to summary
public <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. 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.

Parameters
<X>
the return type of the function
<Y>
the type of the fixed parameter
parameter:Y

a parameter to be passed to the (bi)funtion

biFunction:BiFunction<T, Y, X>

a (bi)function taking as input parameter Y and each of the T from the current stack, and return type of X.

Returns:X

the first non-null result by the function, or null if no matches.

Annotations
@Incubating
getCurrentback to summary
public T getCurrent()

The element currently at the top of the stack

getRootback to summary
public T getRoot()

The element currently at the bottom of the stack

isEmptyback to summary
public boolean isEmpty()

Are there no elements currently in the stack?

peekback to summary
public T peek(int offsetFromTop)

The element at the given offset, relative to the top of the stack

popback to summary
public T pop()

Pop (remove and return) the current element off the stack

pushback to summary
public void push(T newCurrent)

Push the new element on the top of the stack

visitRootFirstback to summary
public void visitRootFirst(Consumer<T> action)

Visit all elements in the stack, starting with the root and working "forward"