Package com.helger.commons.collection
Class StackHelper
java.lang.Object
com.helger.commons.collection.StackHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> getStackCopyWithoutTop
(NonBlockingStack<ELEMENTTYPE> aStack) static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack()
static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack
(int nInitialCapacity) static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack
(ELEMENTTYPE aValue) Create a new stack with a single element.static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack
(ELEMENTTYPE... aValues) Create a new stack from the given array.static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack
(Collection<? extends ELEMENTTYPE> aValues) Create a new stack from the given collection.static <ELEMENTTYPE>
NonBlockingStack<ELEMENTTYPE> newStack
(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <SRCTYPE,
DSTTYPE>
NonBlockingStack<DSTTYPE> newStackMapped
(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, DSTTYPE> aMapper) static <SRCTYPE,
DSTTYPE>
NonBlockingStack<DSTTYPE> newStackMapped
(SRCTYPE[] aArray, Function<? super SRCTYPE, DSTTYPE> aMapper)
-
Method Details
-
newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> newStack(@Nonnegative int nInitialCapacity) -
newStack
-
newStackMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> NonBlockingStack<DSTTYPE> newStackMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newStackMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> NonBlockingStack<DSTTYPE> newStackMapped(@Nullable SRCTYPE[] aArray, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> newStack(@Nullable ELEMENTTYPE aValue) Create a new stack with a single element.- Type Parameters:
ELEMENTTYPE
- The type of elements contained in the stack.- Parameters:
aValue
- The value to push. Maybenull
.- Returns:
- A non-
null
stack.
-
newStack
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> newStack(@Nullable ELEMENTTYPE... aValues) Create a new stack from the given array.- Type Parameters:
ELEMENTTYPE
- The type of elements contained in the stack.- Parameters:
aValues
- The values that are to be pushed on the stack. The last element will be the top element on the stack. May not benull
.- Returns:
- A non-
null
stack object.
-
newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> newStack(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) -
newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> newStack(@Nullable Collection<? extends ELEMENTTYPE> aValues) Create a new stack from the given collection.- Type Parameters:
ELEMENTTYPE
- The type of elements contained in the stack.- Parameters:
aValues
- The values that are to be pushed on the stack. The last element will be the top element on the stack. May not benull
.- Returns:
- A non-
null
stack object.
-
getStackCopyWithoutTop
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack<ELEMENTTYPE> getStackCopyWithoutTop(@Nullable NonBlockingStack<ELEMENTTYPE> aStack)
-