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

public final Class StandardStack<T>

extends Object
implements Stack<T>
Class Inheritance
All Implemented Interfaces
org.hibernate.internal.util.collections.Stack
Type Parameters
<T>
The type of things stored in the stack
Imports
java.lang.reflect.Array, java.util.Arrays, .NoSuchElementException, java.util.function.BiFunction, .Consumer, .Function

A general-purpose stack impl supporting null values.
Authors
Steve Ebersole, Sanne Grinovero, Marco Belladelli

Field Summary

Modifier and TypeField and Description
private T[]
private int
private Class<T>

Constructor Summary

AccessConstructor and Description
public
public
StandardStack(Class<T> type, T initial)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.hibernate.internal.util.collections.Stack.clear.

Remove all elements from the stack
public int
depth()

Implements org.hibernate.internal.util.collections.Stack.depth.

How many elements are currently on the stack?
public <X> X
findCurrentFirst(Function<T, X> function)

Implements org.hibernate.internal.util.collections.Stack.findCurrentFirst.

Find an element on the stack and return a value.
public <X, Y> X
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
)

Implements org.hibernate.internal.util.collections.Stack.findCurrentFirstWithParameter.

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()

Implements org.hibernate.internal.util.collections.Stack.getCurrent.

The element currently at the top of the stack
public T
getRoot()

Implements org.hibernate.internal.util.collections.Stack.getRoot.

The element currently at the bottom of the stack
private void
grow()

private void
init()

public boolean
isEmpty()

Implements org.hibernate.internal.util.collections.Stack.isEmpty.

Are there no elements currently in the stack?
public T
peek(int offsetFromTop)

Implements org.hibernate.internal.util.collections.Stack.peek.

The element at the given offset, relative to the top of the stack
public T
pop()

Implements org.hibernate.internal.util.collections.Stack.pop.

Pop (remove and return) the current element off the stack
public void
push(T e)

Implements org.hibernate.internal.util.collections.Stack.push.

Push the new element on the top of the stack
public void
visitRootFirst(Consumer<T> action)

Implements org.hibernate.internal.util.collections.Stack.visitRootFirst.

Visit all elements in the stack, starting with the root and working "forward"
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

elementsback to summary
private T[] elements
topback to summary
private int top
typeback to summary
private Class<T> type

Constructor Detail

StandardStackback to summary
public StandardStack(Class<T> type)
StandardStackback to summary
public StandardStack(Class<T> type, T initial)

Method Detail

clearback to summary
public void clear()

Implements org.hibernate.internal.util.collections.Stack.clear.

Doc from org.hibernate.internal.util.collections.Stack.clear.

Remove all elements from the stack

Annotations
@Override
depthback to summary
public int depth()

Implements org.hibernate.internal.util.collections.Stack.depth.

Doc from org.hibernate.internal.util.collections.Stack.depth.

How many elements are currently on the stack?

Annotations
@Override
findCurrentFirstback to summary
public <X> X findCurrentFirst(Function<T, X> function)

Implements org.hibernate.internal.util.collections.Stack.findCurrentFirst.

Doc from org.hibernate.internal.util.collections.Stack.findCurrentFirst.

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

Annotations
@Override
findCurrentFirstWithParameterback to summary
public <X, Y> X findCurrentFirstWithParameter(Y parameter, BiFunction<T, Y, X> biFunction)

Implements org.hibernate.internal.util.collections.Stack.findCurrentFirstWithParameter.

Doc from org.hibernate.internal.util.collections.Stack.findCurrentFirstWithParameter.

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
@Override
getCurrentback to summary
public T getCurrent()

Implements org.hibernate.internal.util.collections.Stack.getCurrent.

Doc from org.hibernate.internal.util.collections.Stack.getCurrent.

The element currently at the top of the stack

Annotations
@Override
getRootback to summary
public T getRoot()

Implements org.hibernate.internal.util.collections.Stack.getRoot.

Doc from org.hibernate.internal.util.collections.Stack.getRoot.

The element currently at the bottom of the stack

Annotations
@Override
growback to summary
private void grow()
initback to summary
private void init()
Annotations
@SuppressWarnings:unchecked
isEmptyback to summary
public boolean isEmpty()

Implements org.hibernate.internal.util.collections.Stack.isEmpty.

Doc from org.hibernate.internal.util.collections.Stack.isEmpty.

Are there no elements currently in the stack?

Annotations
@Override
peekback to summary
public T peek(int offsetFromTop)

Implements org.hibernate.internal.util.collections.Stack.peek.

Doc from org.hibernate.internal.util.collections.Stack.peek.

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

Annotations
@Override
popback to summary
public T pop()

Implements org.hibernate.internal.util.collections.Stack.pop.

Doc from org.hibernate.internal.util.collections.Stack.pop.

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

Annotations
@Override
pushback to summary
public void push(T e)

Implements org.hibernate.internal.util.collections.Stack.push.

Doc from org.hibernate.internal.util.collections.Stack.push.

Push the new element on the top of the stack

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

Implements org.hibernate.internal.util.collections.Stack.visitRootFirst.

Doc from org.hibernate.internal.util.collections.Stack.visitRootFirst.

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

Annotations
@Override