Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

SimplePool

class SimplePool<T : Any!> : Pools.Pool<T>
kotlin.Any
   ↳ androidx.core.util.Pools.SimplePool

Simple (non-synchronized) pool of objects.

Summary

Public constructors

<init>(maxPoolSize: Int)

Creates a new instance.

Public methods

open T?

open Boolean
release(@NonNull instance: T)

Public constructors

<init>

SimplePool(maxPoolSize: Int)

Creates a new instance.

Parameters
maxPoolSize Int: The max pool size.
Exceptions
IllegalArgumentException If the max pool size is less than zero.

Public methods

acquire

open fun acquire(): T?

release

open fun release(@NonNull instance: T): Boolean