pool

fun <T> pool(reset: (T) -> Unit = {}, preallocate: Int = 0, gen: Pool<T>.(Int) -> T): Pool<T>

Creates a Pool instance and then generates the object by passing in the Pool instance.

Parameters

preallocate

the number of objects to preallocate

gen

the object generate function to create a new object when needed