Я заглянул внутрь класса AtomicInteger
и наткнулся на следующий метод:
/**
* Atomically increments by one the current value.
*
* @return the previous value
*/
public final int getAndIncrement() {
for (;;) {
int current = get();
int next = current + 1;
if (compareAndSet(current, next))
return current;
}
}
Может кто-нибудь объяснить, что означает for(;;)
?