popAll

fun popAll(numToPop: Int = data.size): List<T>

Pops the n topmost elements in this Stack, where n is specified by the parameter. The topmost element in the stack gets the list's head i.e. index 0.

Return

The popped elements in a List, with the last popped element at the highest index.

Parameters

numToPop

Specifies how many elements to pop.

Throws

If numToPop is negative or greater than the Stack's size.