public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue) {
    if (moveToFirst()) {
      return toOnlyElement(singleRowTransform);
    } else {
      close();
      return defaultValue;
    }
  }
public < T > T toOnlyElement ( Function < ? super Cursor , T > singleRowTransform , T defaultValue ) { if ( moveToFirst ( ) ) { return toOnlyElement ( singleRowTransform ) ; } else { close ( ) ; return defaultValue ; } }
Returns the only row of this cursor transformed using the given function,
or the supplied default value if cursor is empty.
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 or the supplied default
value if the cursor is empty. If the cursor contains more than one
row, IllegalArgumentException is thrown.