/** * Returns the element that is right after the given index. */ public static <T> T getNext(int index, List<T> list) { return list.get(next(index, list)); }
/** * Removes all the elements from the list from startIndex (excluded) to endIndex (excluded). */ public static int removeAllExclusive(int startIndex, int endIndex, List<?> list) { int numberOfElementsToRemove = subLengthExclusive(startIndex, endIndex, list); startIndex = next(startIndex, list); for (int count = 0; count < numberOfElementsToRemove; count++) { startIndex = wrap(startIndex, list); list.remove(startIndex); } return numberOfElementsToRemove; } }