Code example for AtomicReference

Methods: compareAndSet

0
    public T GetSnapshot(){ 
        return dataPoint.get().Clone();
    } 
 
    private boolean setDataPoint(T expected, T newValue){
        return dataPoint.compareAndSet(expected, newValue);
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java