The following piece of documentation for ArrayList doesn't seem right to me:
The operations size, isEmpty, get, set, iterator and listIterator are performed in constant time.
Now set to:
set (index int, element E)
Replaces the element at the specified position in this list with the specified element.
Thus, this can be used to add an element in the middle of an ArrayList and make the rest of the elements move.
But this is considered linear, not permanent.
Am I wrong here? Or am I losing something?
source
share