You will have to get()
the value, change it, and then set()
the new value:
for (int j = 0; j < position.size(); j++) {
new_position.set(j, new_position.get(j) - 4);
}
An alternative solution could be to skip the whole copying of the list, and instead iterate through the original list, change each value as you go, and add them to the new List
:
public static ArrayList<Integer> new_position = new ArrayList<Integer>();
for (Integer i: position) {
new_position.add(i - 4);
}