private ArrayList<Long> buildCursorPositionMapping(final long[] order,final String columnName,final List<? extends Object> extraData){
  ArrayList<Long> missingIds=new ArrayList<Long>();
  mOrderedPositions=new ArrayList<Integer>(mCursor.getCount());
  mExtraData=new ArrayList<Object>();
  mMapCursorPositions=new HashMap<Long,Integer>(mCursor.getCount());
  final int idPosition=mCursor.getColumnIndex(columnName);
  if (mCursor.moveToFirst()) {
    do {
      mMapCursorPositions.put(mCursor.getLong(idPosition),mCursor.getPosition());
    }
 while (mCursor.moveToNext());
    for (int i=0; order != null && i < order.length; i++) {
      final long id=order[i];
      if (mMapCursorPositions.containsKey(id)) {
        mOrderedPositions.add(mMapCursorPositions.get(id));
        mMapCursorPositions.remove(id);
        if (extraData != null) {
          mExtraData.add(extraData.get(i));
        }
      }
 else {
        missingIds.add(id);
      }
    }
    mCursor.moveToFirst();
  }
  return missingIds;
}

private ArrayList < Long > buildCursorPositionMapping ( final long [ ] order , final String columnName , final List < ? extends Object > extraData ) { ArrayList < Long > missingIds = new ArrayList < Long > ( ) ; mOrderedPositions = new ArrayList < Integer > ( mCursor . getCount ( ) ) ; mExtraData = new ArrayList < Object > ( ) ; mMapCursorPositions = new HashMap < Long , Integer > ( mCursor . getCount ( ) ) ; final int idPosition = mCursor . getColumnIndex ( columnName ) ; if ( mCursor . moveToFirst ( ) ) { do { mMapCursorPositions . put ( mCursor . getLong ( idPosition ) , mCursor . getPosition ( ) ) ; } while ( mCursor . moveToNext ( ) ) ; for ( int i = 0 ; order != null && i < order . length ; i ++ ) { final long id = order [ i ] ; if ( mMapCursorPositions . containsKey ( id ) ) { mOrderedPositions . add ( mMapCursorPositions . get ( id ) ) ; mMapCursorPositions . remove ( id ) ; if ( extraData != null ) { mExtraData . add ( extraData . get ( i ) ) ; } } else { missingIds . add ( id ) ; } } mCursor . moveToFirst ( ) ; } return missingIds ; }
this function populates morderedpositions with the cursor positions in the order based on the order passed in
