As mentioned in Java API Doc and this post, the list.add(index,element) results in the given element being added at the given index. In the process, the subsequent list items are shifted by one position to the right (by adding one to their indices as mentioned in the API Doc)
My question is how does this happen practically?
Suppose we have an ArrayList containing 100 elements and we say add(0, 6), now how would the API accomplish this action, given the fact that the underlying Data Structure is an array?
More specifically: Would all the existing 100 elements be copied to its immediate right location? Or is there a more efficient way by which this is handled?