Package panda.utilities
Class StackUtils
java.lang.Object
panda.utilities.StackUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Stack<T>Fill the stack with the specified objectstatic <T> Stack<T>of(Collection<? extends T> collection) Create stack using another collectionstatic <T> Stack<T>popSilently(Stack<T> stack, int amount) Pop multiple values at once without worries that the stack is emptystatic <T> Stack<T>Push multiple values at oncestatic <T> Stack<T>Reverse the stack
-
Method Details
-
push
Push multiple values at once- Type Parameters:
T- the type of the stack content- Parameters:
stack- the stack to fillvalues- the values to push- Returns:
- the stack
-
popSilently
Pop multiple values at once without worries that the stack is empty- Type Parameters:
T- the type of the values- Parameters:
stack- the stack to drainamount- amount of values to pop- Returns:
- the stack
-
fill
Fill the stack with the specified object- Type Parameters:
T- the type of the values- Parameters:
stack- the stack to fillobject- the object to pushamount- amount of pushes- Returns:
- the stack
-
reverse
Reverse the stack- Type Parameters:
T- the type of the values- Parameters:
stack- the stack to reverse- Returns:
- the stack with reversed values (the same instance)
-
of
Create stack using another collection- Type Parameters:
T- type of collection- Parameters:
collection- the collection to use- Returns:
- a new stack based on the specified collection
-