Does the ability to synchronize the increment of a variable exist, so that picking up the values ββof i the thread will work with it further along the code, and the next thread would use the variable i with the next value (i + 1). Ie there is a loop and the threads in it should work with ArrayList elements:
for ( int i = 0; i < arrayList.size(); i++) { System.out.println(arrayList.get(i)); newArrayList.add(arrayList.get(i)); } The problem is that it is impossible to force the threads to miss the unique values ββof i, and the threads work with the same data ...
java.concurrent.atomic.AtomicInteger- ArchDemon