Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Pool

interface Pool<T : Any!>
androidx.core.util.Pools.Pool

Interface for managing a pool of objects.

Summary

Public methods
abstract T?

abstract Boolean
release(@NonNull instance: T)

Release an instance to the pool.

Public methods

acquire

@Nullable abstract fun acquire(): T?
Return
T?: An instance from the pool if such, null otherwise.

release

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

Release an instance to the pool.

Parameters
instance T: The instance to release.
Return
Boolean: Whether the instance was put in the pool.
Exceptions
IllegalStateException If the instance is already in the pool.