AtomicLong: getAndIncrement()
import java.util.concurrent.atomic.AtomicLong;
public class Main {
public static void main(String[] argv) {
AtomicLong nextId = new AtomicLong();
System.out.println(nextId.getAndIncrement());
}
}
Related examples in the same category