Code example for AtomicLong

0
class ManualClock implements Clock { 
 
    private final AtomicLong time;
 
    ManualClock(long init) {
        time = new AtomicLong(init);
    } 
 
    void set(long t) {
        time.set(t);
    } 
 
    public long now() { 
        return time.get();
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE