Code example for LruCache

0
    if (blocks > 0) {
      this.maxBlockId = blocks - 1;
    } 
 
    // block cache is Lru cache based on gets and puts 
    blockCache = new LruCache<Integer, List<T>>(blocksToCache);
  } 
 
  /** 
   * Returns the backing object, aka row, for the position.  The backing object 
   * is the object that was cached for a given position.  Blocks contains one 
   * or more backing objects. 
   *  
   * @param position The row position in the list. 
   *  
   * @return The backing object at the position. 
   */ 
  public T getBackingObject(int position) {
 
    // get the block id and block position from the row position 
    int[] blockIdAndPos = getBlockIdAndPosition(position);