Removes from this list all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
Removes from this list all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)Note: No memory of the elements themselves is freed.
For array lists removing from the end of the list has a time complexity of O(M), while removing from the beginning of the list has a time complexity of O(N + M) with N being the number of elements in the list and M being the number of elements removed.
For linked lists removing from the beginning or the end of the list has a time complexity of O(M), while removing from a random position in the middle of the list has a time complexity of O(N + M) with N being the number of elements in the list and M being the number of elements removed.