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


class Pools
   ↳ androidx.core.util.Pools

Helper class for creating pools of objects. An example use looks like this:

 public class MyPooledClass { private static final SynchronizedPool sPool = new SynchronizedPool(10); public static MyPooledClass obtain() { MyPooledClass instance = sPool.acquire(); return (instance != null) ? instance : new MyPooledClass(); } public void recycle() { // Clear state if needed. sPool.release(this); } . . . } 


Nested classes

Interface for managing a pool of objects.

Simple (non-synchronized) pool of objects.

Synchronized) pool of objects.