Exemplo n.º 1
0
  @Override
  public E get(int location) {
    E result = Reflection.instantiate(clazz);

    if (useCache) {
      result = cache.get(location);
    } else {
      cursor.moveToPosition(location);
      result.fromCursor(cursor);
      cache.put(location, result);

      if (cache.size() == count) {
        useCache = true;
        cursor.close();
      }
    }

    return result;
  }