added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
Pools
public
final
class
Pools
extends Object
| java.lang.Object | |
| ↳ | android.support.v4.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);
}
. . .
}
Summary
Nested classes | |
|---|---|
interface |
Pools.Pool<T>
Interface for managing a pool of objects. |
class |
Pools.SimplePool<T>
Simple (non-synchronized) pool of objects. |
class |
Pools.SynchronizedPool<T>
Synchronized) pool of objects. |
Inherited methods | |
|---|---|
java.lang.Object
| |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]