Pool

class Pool<T>

Structure containing a set of reusable objects.

The method alloc retrieves from the pool or allocates a new object, while the free method pushes back one element to the pool and resets it to reuse it.

Constructors

Link copied to clipboard
fun <T> Pool(reset: (T) -> Unit = {}, preallocate: Int = 0, gen: (Int) -> T)

Structure containing a set of reusable objects.

Link copied to clipboard
fun <T> Pool(preallocate: Int = 0, gen: (Int) -> T)

Structure containing a set of reusable objects.

Functions

Link copied to clipboard
fun alloc(): T
inline fun <R> alloc(callback: (T) -> R): R
Link copied to clipboard
inline fun <R> allocMultiple(count: Int, temp: MutableList<T> = mutableListOf(), callback: (MutableList<T>) -> R): R
Link copied to clipboard
inline fun <R> allocThis(callback: T.() -> R): R
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun free(element: T)
fun free(vararg elements: T)
fun free(elements: Iterable<T>)
fun free(elements: List<T>)
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
inline operator fun <R> invoke(callback: (T) -> R): R
Link copied to clipboard
fun setup(reset: (T) -> Unit = {}, preallocate: Int, gen: (Int) -> T)

Setup structure containing a set of reusable objects.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard