code: private static int findGroupEnd(PagesIndex pagesIndex, PagesHashStrategy pagesHashStrategy, int startPosition)
      {
          checkArgument(pagesIndex.getPositionCount() > 0, "Must have at least one position");
          checkPositionIndex(startPosition, pagesIndex.getPositionCount(), "startPosition out of bounds");
  
          return findEndPosition(startPosition, pagesIndex.getPositionCount(), (firstPosition, secondPosition) -> pagesIndex.positionEqualsPosition(pagesHashStrategy, firstPosition, secondPosition));
      }
docs: Assumes input grouped on relevant pagesHashStrategy columns