arraylist replace item at index code example
Example 1: modify element in list java
list.set( 2, "New" );
Example 2: java replace element in list
list.set(4, "element at index 4 is replaced by this string");
list.set( 2, "New" );
list.set(4, "element at index 4 is replaced by this string");