code: private static int _indexOfStartingFrom(List<?> list, int startIndex, Object searchValue)
      {
          int itemCount = list.size();
  
          boolean found = false;
  
          // start searching from location remembered from last time
          for (int currIndex = startIndex; currIndex < itemCount; currIndex++)
          {
              Object currId = list.get(currIndex);
  
              if ((searchValue == currId) || ((searchValue != null) && searchValue.equals(currId)))
              {
                  return currIndex;
              }
          }
  
          // handle case where we started past the first item and didn't find the
          // searchValue.  Now search from the beginning to where we started
          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;
                  }
              }
          }
  
          // didn't find it
          return -1;
      }
docs: 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.
  @param <T>
  @param list List to seatch
  @param startIndex index to start searching for value from
  @param searchValue Value to search for (null not supported)
  @return The index at which the value was first found, or -1 if not found