private static int _indexOfStartingFrom(List<?> list,int startIndex,Object searchValue){
  int itemCount=list.size();
  boolean found=false;
  for (int currIndex=startIndex; currIndex < itemCount; currIndex++) {
    Object currId=list.get(currIndex);
    if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId))) {
      return currIndex;
    }
  }
  if (startIndex > 0) {
    for (int currIndex=0; currIndex < startIndex; currIndex++) {
      Object currId=list.get(currIndex);
      if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId))) {
        return currIndex;
      }
    }
  }
  return -1;
}

private static int _indexOfStartingFrom ( List < ? > list , int startIndex , Object searchValue ) { int itemCount = list . size ( ) ; boolean found = false ; for ( int currIndex = startIndex ; currIndex < itemCount ; currIndex ++ ) { Object currId = list . get ( currIndex ) ; if ( ( searchValue == currId ) || ( ( searchValue != null ) && searchValue . equals ( currId ) ) ) { return currIndex ; } } if ( startIndex > 0 ) { for ( int currIndex = 0 ; currIndex < startIndex ; currIndex ++ ) { Object currId = list . get ( currIndex ) ; if ( ( searchValue == currId ) || ( ( searchValue != null ) && searchValue . equals ( currId ) ) ) { return currIndex ; } } } return - 1 ; }
similar to list . indexof , except that we start searching from a specific index and then wrap aroud . for this to be performant , the list should implement randomaccess .
