public class AtomicReference<V> extends AtomicReference<V>
getOrSetAndGetIf(Object, Object) and update(Function).| Constructor and Description |
|---|
AtomicReference()
Creates a new AtomicReference with null initial value.
|
AtomicReference(V initialValue)
Creates a new AtomicReference with the given initial value.
|
| Modifier and Type | Method and Description |
|---|---|
V |
getOrSetAndGetIf(V oldValue,
Supplier<V> newValue)
Check the current value and if it matches the old value argument, set it to
the one created by the
new value supplier and return that
instead. |
V |
getOrSetAndGetIf(V oldValue,
V newValue)
Check the current value and if it matches the old value argument, set it to
the new value and return that instead.
|
V |
update(Function<V,V> newValueFactory)
Do the actual update.
|
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, toString, updateAndGet, weakCompareAndSetpublic AtomicReference()
public AtomicReference(V initialValue)
initialValue - the initial valuepublic final V getOrSetAndGetIf(V oldValue, Supplier<V> newValue)
new value supplier and return that
instead. If the old value argument does not match, ignore both and just
return the current value.oldValue - to check the current value against (reference equality
check only).newValue - a Supplier for a new value. May
be called more than once.public final V getOrSetAndGetIf(V oldValue, V newValue)
oldValue - to check the current value against (reference equality
check only)newValue - the new value to set it toCopyright © 2024 Atlassian. All rights reserved.