HHH-13876 Remove unused code from StandardStack
This commit is contained in:
parent
e65ef1354c
commit
b856d534cb
|
@ -6,9 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.internal.util.collections;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Stack implementation exposing useful methods for Hibernate needs.
|
||||
*
|
||||
|
@ -47,14 +44,4 @@ public interface Stack<T> {
|
|||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Visit all elements in the stack, starting with the current and working back
|
||||
*/
|
||||
void visitCurrentFirst(Consumer<T> 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
|
||||
*/
|
||||
<X> X findCurrentFirst(Function<T, X> action);
|
||||
}
|
||||
|
|
|
@ -17,16 +17,13 @@ import java.util.function.Function;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class StandardStack<T> implements Stack<T> {
|
||||
private LinkedList<T> internalStack = new LinkedList<>();
|
||||
public final class StandardStack<T> implements Stack<T> {
|
||||
|
||||
private final LinkedList<T> internalStack = new LinkedList<>();
|
||||
|
||||
public StandardStack() {
|
||||
}
|
||||
|
||||
public StandardStack(T initial) {
|
||||
internalStack.add( initial );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void push(T newCurrent) {
|
||||
internalStack.addFirst( newCurrent );
|
||||
|
@ -57,19 +54,4 @@ public class StandardStack<T> implements Stack<T> {
|
|||
internalStack.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCurrentFirst(Consumer<T> action) {
|
||||
internalStack.forEach( action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X findCurrentFirst(Function<T, X> function) {
|
||||
for ( T t : internalStack ) {
|
||||
final X result = function.apply( t );
|
||||
if ( result != null ) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue