Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public final class

Pools

extends Object
java.lang.Object
   ↳ android.support.v4.util.Pools

Class Overview

Helper class for crating 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. 
[Expand]
Inherited Methods
From class java.lang.Object