Stack

fun Stack(initialCapacity: Int = 8, scaleFactor: Float = 1.5f, maxSize: Int = Int.MAX_VALUE)

Constructs a new Stack instance.

Parameters

initialCapacity

Initial capacity for the stack.

Default: 8

scaleFactor

Factor by which the stack's capacity will be increased at a time when required to contain pushed values.

When a value is pushed onto the stack that would increase the stack's size to be greater than the stack's capacity, the data container underlying this stack will be resized to increase the capacity at a rate of capacity * scaleFactor.

Default: 1.5

maxSize

Size cap for the stack. If an attempt is made to push a number of items into this stack that is greater than the maxSize value, an exception will be thrown.

Default: 2147483647