code: public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform) {
      try {
        switch (getCount()) {
        case 0:
          throw new NoSuchElementException();
        case 1:
          moveToFirst();
          return singleRowTransform.apply(this);
        default:
          throw new IllegalArgumentException("expected one element but was: " + getCount());
        }
      } finally {
        close();
      }
    }
docs: Returns the only row of this cursor transformed using the given function.
  WARNING: This method closes cursor. Do not use this from onLoadFinished()
  
  @param singleRowTransform Function to apply on the only row of this cursor
  @param <T> Type of returned element
  @return Transformed first row of the cursor. If the cursor is empty,
  NoSuchElementException is thrown. If the cursor contains more than one
  row, IllegalArgumentException is thrown.