Code example for AtomicLong

Methods: getAndIncrement

0
 
public class IdSpace { 
    private AtomicLong currentId = new AtomicLong(0);
     
    public long nextId() { 
        return currentId.getAndIncrement();
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE