Code example for SparseIntArray

Methods: get, put

0
		} else if (sectionIndex >= mActiveSections.size()) {
			return mDataset.size() - 1; // last position
		} 
 
		int position = 0;
		position = mPositionsCache.get(sectionIndex, -1);
		if (position != -1) { // cached position
			return position;
		} else { // no cached position for section index 
			String section = mActiveSections.get(sectionIndex);
			final Integer positionBoxed = mSectionIndexesCache.get(section);
			if (positionBoxed != null) { // position for section cached
				position = positionBoxed.intValue();
				mSectionsCache.put(position, sectionIndex);
				mPositionsCache.put(sectionIndex, position);
				return position;
			} else { // recursively search for previous existing section 
				return getPositionForSection(sectionIndex - 1);
			} 
		} 
	}