E - the element type of the array.public class AtomicReferenceArray<E> extends AtomicReferenceArray<E>
getOrSetAndGetIf(int, Object, Object) and
update(int, Function).| Constructor and Description |
|---|
AtomicReferenceArray(E[] initialValue)
Creates a new AtomicReferenceArray with the same length as, and all
elements copied from, the given array.
|
AtomicReferenceArray(int length)
Creates a new AtomicReferenceArray of given length.
|
| Modifier and Type | Method and Description |
|---|---|
E |
getOrSetAndGetIf(int index,
E oldValue,
E newValue)
Check the current value and if it matches the old value argument, set it to
the new value and return that instead.
|
E |
getOrSetAndGetIf(int index,
E oldValue,
Supplier<E> 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. |
E |
update(int index,
Function<E,E> newValueFactory)
Do the actual update.
|
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, length, set, toString, updateAndGet, weakCompareAndSetpublic AtomicReferenceArray(int length)
length - the length of the arraypublic AtomicReferenceArray(E[] initialValue)
initialValue - the array to copy elements fromNullPointerException - if array is nullpublic final E getOrSetAndGetIf(int index, E oldValue, Supplier<E> 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.index - a int.public final E getOrSetAndGetIf(int index, E oldValue, E newValue)
oldValue - to check the current value against (reference equality
check only)newValue - the new value to set it toindex - a int.public final E update(int index, Function<E,E> newValueFactory)
index - a int.newValueFactory - a Function object.Copyright © 2016 Atlassian. All rights reserved.