code: public <TKey, TValue> LinkedHashMap<TKey, TValue> toMap(Function<? super Cursor, TKey> keyTransform, Function<? super Cursor, TValue> valueTransform) {
      try {
        LinkedHashMap<TKey, TValue> result = new LinkedHashMap<>(getCount(), 1);
  
        for (moveToFirst(); !isAfterLast(); moveToNext()) {
          final TKey key = keyTransform.apply(this);
          final TValue value = valueTransform.apply(this);
  
          final TValue previousValue = result.put(key, value);
  
          Preconditions.checkArgument(previousValue == null, "Duplicate key %s found on position %s", key, getPosition());
        }
  
        return result;
      } finally {
        close();
      }
    }
docs: Transforms Cursor to LinkedHashMap<TKey, TValue> by applying given
  functions. The iteration order for the returned map is the same as
  the iteration order over rows of Cursor.
  WARNING: This method closes cursor. Do not use this from onLoadFinished()
  
  @param keyTransform Function to apply on every single row of this cursor
  to get the key of the entry representing this row.
  @param valueTransform Function to apply on every single row of this cursor
  to get the value of the entry representing this row.
  @param <TKey> Type of keys in the returned map
  @param <TValue> Type of values in the returned map
  @return Transformed map
  @throws IllegalArgumentException if Cursor contains duplicate keys