Java ArrayList replace at specific index
Solution 1:
Check out the set(int index, E element)
method in the List interface
Solution 2:
You can replace the items at specific position using set method of ArrayList as below:
list.set( your_index, your_item );
But the element should be present at the index you are passing inside set() method else it will throw exception.
Also you can check oracle doc here