protected void removeRange(int fromIndex, int toIndex) { checkForComodification(); l.removeRange(fromIndex + offset, toIndex + offset); expectedModCount = l.modCount; size -= (toIndex - fromIndex); modCount++; }
/** * Removes all of the elements from this list (optional operation). The list will be empty after * this call returns. * * <p>This implementation calls {@code removeRange(0, size())}. * * <p>Note that this implementation throws an {@code UnsupportedOperationException} unless {@code * remove(int index)} or {@code removeRange(int fromIndex, int toIndex)} is overridden. * * @throws UnsupportedOperationException if the {@code clear} operation is not supported by this * list */ public void clear() { removeRange(0, size()); }