package com.getbase.android.db.loaders;

import com.getbase.android.db.cursors.Cursors;
import com.google.common.base.Function;

import android.database.Cursor;
import android.support.v4.util.LruCache;

import java.util.AbstractList;
import java.util.RandomAccess;

class LazyCursorList<T> extends AbstractList<T> implements RandomAccess {

  private final Cursor cursor;
  private final Function<Cursor, T> transformation;
  private final LruCache<Integer, T> cache;

  public LazyCursorList(Cursor cursor, Function<Cursor, T> function) {
    this(cursor, function, 256);
  }

  public LazyCursorList(final Cursor cursor, Function<Cursor, T> function, int cacheSize) {
    this.cursor = Cursors.returnSameOrEmptyIfNull(cursor);
    this.transformation = function;

    cache = new LruCache<Integer, T>(cacheSize) {
      @Override
      protected T create(Integer key) {
        cursor.moveToPosition(key);
        return transformation.apply(cursor);
      }
    };
  }

  @Override
  public T get(int i) {
    return cache.get(i);
  }

  @Override
  public int size() {
    return cursor.getCount();
  }
}

@@ -369,60 +369,8 @@
 or;%0A
-  private final Function%3CCursor, T%3E transformation;%0A
   pr
@@ -409,16 +409,16 @@
  cache;%0A
+
 %0A  publi
@@ -555,32 +555,38 @@
 l Cursor cursor,
+ final
  Function%3CCursor
@@ -679,44 +679,8 @@
 or);
-%0A    this.transformation = function;
 %0A%0A  
@@ -838,18 +838,12 @@
 urn 
-transforma
+func
 tion

Remove unused member