question: int findSyncPosition ( ) { int count = mItemCount ; if ( count == 0 ) { return INVALID_POSITION ; } long idToMatch = mSyncRowId ; int seed = mSyncPosition ; if ( idToMatch == INVALID_ROW_ID ) { return INVALID_POSITION ; } seed = Math . max ( 0 , seed ) ; seed = Math . min ( count - 1 , seed ) ; long endTime = SystemClock . uptimeMillis ( ) + SYNC_MAX_DURATION_MILLIS ; long rowId ; int first = seed ; int last = seed ; boolean next = false ; boolean hitFirst ; boolean hitLast ; T adapter = getAdapter ( ) ; if ( adapter == null ) { return INVALID_POSITION ; } while ( SystemClock . uptimeMillis ( ) <= endTime ) { rowId = adapter . getItemId ( seed ) ; if ( rowId == idToMatch ) { return seed ; } hitLast = last == count - 1 ; hitFirst = first == 0 ; if ( hitLast && hitFirst ) { break ; } if ( hitFirst || ( next && ! hitLast ) ) { last ++ ; seed = last ; next = false ; } else if ( hitLast ) { first -- ; seed = first ; next = true ; } } return INVALID_POSITION ; }
target:  Searches the adapter for a position matching mSyncRowId. The search starts at mSyncPosition and then alternates between moving up and moving down until 1) we find the right position, or 2) we run out of time, or 3) we have looked at every position