SubList
is not an independent entity, but it is just giving a view of the original list, and internally refers to same list. Hence, its design seem to be such that if underlying list is modified structurally (addition/removal of elements), it is not able to fulfill its contract.
As can be seen here in the source code of SubList, the method checkForComodification
checks whether the underlying list has been modified, and thus if the modCount
(number of times the list has been structurally modified) value of SubList
is not same as parent ArrayList
, then, it throws ConcurrentModificationException
So, clearing parent ArrayList
from which SubList
was created can result in the certain operations of SubList
to result in ConcurrentModificationException