public final class StackUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Stack<T> |
fill(Stack<T> stack,
T object,
int amount)
Fill the stack with the specified object
|
static <T> Stack<T> |
of(Collection<? extends T> collection)
Create stack using another collection
|
static <T> Stack<T> |
popSilently(Stack<T> stack,
int amount)
Pop multiple values at once without worries that the stack is empty
|
static <T> Stack<T> |
push(Stack<T> stack,
T... values)
Push multiple values at once
|
static <T> Stack<T> |
reverse(Stack<T> stack)
Reverse the stack
|
@SafeVarargs public static <T> Stack<T> push(Stack<T> stack, T... values)
T - the type of the stack contentstack - the stack to fillvalues - the values to pushpublic static <T> Stack<T> popSilently(Stack<T> stack, int amount)
T - the type of the valuesstack - the stack to drainamount - amount of values to poppublic static <T> Stack<T> fill(Stack<T> stack, T object, int amount)
T - the type of the valuesstack - the stack to fillobject - the object to pushamount - amount of pushespublic static <T> Stack<T> reverse(Stack<T> stack)
T - the type of the valuesstack - the stack to reversepublic static <T> Stack<T> of(Collection<? extends T> collection)
T - type of collectioncollection - the collection to useCopyright © 2020. All rights reserved.