Code example for SparseArray

Methods: delete, get

0
            mScrapHeap.put(position, v);
        } 
 
        View get(int position) {
            // System.out.print("Looking for " + position); 
            View result = mScrapHeap.get(position);
            if (result != null) {
                // System.out.println(" HIT"); 
                mScrapHeap.delete(position);
            } else { 
                // System.out.println(" MISS"); 
            } 
            return result;
        } 
 
        void clear() { 
            final SparseArray<View> scrapHeap = mScrapHeap;
            final int count = scrapHeap.size();
            for (int i = 0; i < count; i++) {
                final View view = scrapHeap.valueAt(i);
                if (view != null) {