/** * Gets the current value. * * @return the current value */ public long get() { return operations.get(key); }
/** * Atomically adds the given value to the current value. * * @param delta the value to add * @return the updated value */ public long addAndGet(long delta) { return operations.increment(key, delta); }
/** * Atomically sets to the given value and returns the old value. * * @param newValue the new value * @return the previous value */ public long getAndSet(long newValue) { return operations.getAndSet(key, newValue); }
/** * Atomically decrements by one the current value. * * @return the updated value */ public long decrementAndGet() { return operations.increment(key, -1); }
/** * Sets to the given value. * * @param newValue the new value */ public void set(long newValue) { operations.set(key, newValue); }