Code example for LongSparseArray

import java.lang.ref.WeakReference; 
import java.util.HashMap; 
import java.util.Map; 
public final class DrawableCompat { 
    private static final Map<String, Class<? extends Drawable>> CLASS_MAP = new HashMap<String, Class<? extends Drawable>>();
    private static final LongSparseArray<WeakReference<Drawable.ConstantState>> sDrawableCache = new LongSparseArray<WeakReference<Drawable.ConstantState>>();
    static { 
        registerDrawable(RotateDrawable.class, "rotate");
        registerDrawable(LayerDrawable.class, "layer-list");
        registerDrawable(StateListDrawable.class, "selector");
        registerDrawable(ColorDrawable.class, "color");
    private DrawableCompat() { 
    public static void registerDrawable(Class<? extends Drawable> clazz, String name) {
Connect your IDE to all the code out there  Get Codota for Java