set method

E set(
  1. int index,
  2. E element
)

Replaces the element at the specified index.

index the index of the element to replace element the new element Returns the previous element at the index

Implementation

E set(int index, E element) {
  E oldElement = _list[index];
  _list[index] = element;
  return oldElement;
}