long
array in which elements may be updated atomically.
See the VarHandle
specification for descriptions of the
properties of atomic accesses.
Modifier and Type | Field and Description |
---|---|
private static final VarHandle | |
private final long[] | |
private static final long |
Access | Constructor and Description |
---|---|
public | AtomicLongArray(int
the length of the array length)Creates a new AtomicLongArray of the given length, with all elements initially zero. |
public | AtomicLongArray(long[]
the array to copy elements from array)Creates a new AtomicLongArray with the same length as, and all elements copied from, the given array. |
Modifier and Type | Method and Description |
---|---|
public final long | Returns: the updated valuethe index i, long the update value x, LongBinaryOperator a side-effect-free function of two arguments accumulatorFunction)Atomically updates (with memory effects as specified by |
public long | Returns: the updated valuethe index i, long the value to add delta)Atomically adds the given value to the element at index |
public final long | Returns: the witness value, which will be the same as the expected value if successfulthe index i, long the expected value expectedValue, long the new value newValue)Atomically sets the element at index |
public final long | Returns: the witness value, which will be the same as the expected value if successfulthe index i, long the expected value expectedValue, long the new value newValue)Atomically sets the element at index |
public final long | Returns: the witness value, which will be the same as the expected value if successfulthe index i, long the expected value expectedValue, long the new value newValue)Atomically sets the element at index |
public final boolean | Returns: true if successful. False return indicates that
the actual value was not equal to the expected value.the index i, long the expected value expectedValue, long the new value newValue)Atomically sets the element at index |
public final long | Returns: the updated valuethe index i)Atomically decrements the value of the element at index |
public final long | Returns: the current valuethe index i)Returns the current value of the element at index |
public final long | Returns: the valuethe index i)Returns the current value of the element at index |
public final long | Returns: the previous valuethe index i, long the update value x, LongBinaryOperator a side-effect-free function of two arguments accumulatorFunction)Atomically updates (with memory effects as specified by |
public final long | Returns: the previous valuethe index i, long the value to add delta)Atomically adds the given value to the element at index |
public final long | Returns: the previous valuethe index i)Atomically decrements the value of the element at index |
public final long | Returns: the previous valuethe index i)Atomically increments the value of the element at index |
public final long | Returns: the previous valuethe index i, long the new value newValue)Atomically sets the element at index |
public final long | Returns: the previous valuethe index i, LongUnaryOperator a side-effect-free function updateFunction)Atomically updates (with memory effects as specified by |
public final long | Returns: the valuethe index i)Returns the current value of the element at index |
public final long | Returns: the valuethe index i)Returns the current value of the element at index |
public final long | Returns: the updated valuethe index i)Atomically increments the value of the element at index |
public final void | lazySet(int
the index i, long the new value newValue)Sets the element at index |
public final int | |
public final void | set(int
the index i, long the new value newValue)Sets the element at index |
public final void | setOpaque(int
the index i, long the new value newValue)Sets the element at index |
public final void | setPlain(int
the index i, long the new value newValue)Sets the element at index |
public final void | setRelease(int
the index i, long the new value newValue)Sets the element at index |
public String | Returns: the String representation of the current values of arrayOverrides java. Returns the String representation of the current values of array. |
public final long | Returns: the updated valuethe index i, LongUnaryOperator a side-effect-free function updateFunction)Atomically updates (with memory effects as specified by |
public final boolean | Returns: true if successfulthe index i, long the expected value expectedValue, long the new value newValue)
Deprecated
since 9. This method has plain memory effects but the method
name implies volatile memory effects (see methods such as
compareAndExchange and compareAndSet ).
Possibly atomically sets the element at index |
public final boolean | Returns: true if successfulthe index i, long the expected value expectedValue, long the new value newValue)Possibly atomically sets the element at index |
public final boolean | Returns: true if successfulthe index i, long the expected value expectedValue, long the new value newValue)Possibly atomically sets the element at index |
public final boolean | Returns: true if successfulthe index i, long the expected value expectedValue, long the new value newValue)Possibly atomically sets the element at index |
public final boolean | Returns: true if successfulthe index i, long the expected value expectedValue, long the new value newValue)Possibly atomically sets the element at index |
AA | back to summary |
---|---|
private static final VarHandle AA |
array | back to summary |
---|---|
private final long[] array |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID |
AtomicLongArray | back to summary |
---|---|
public AtomicLongArray(int length) Creates a new AtomicLongArray of the given length, with all elements initially zero.
|
AtomicLongArray | back to summary |
---|---|
public AtomicLongArray(long[] array) Creates a new AtomicLongArray with the same length as, and all elements copied from, the given array.
|
accumulateAndGet | back to summary |
---|---|
public final long accumulateAndGet(int i, long x, LongBinaryOperator accumulatorFunction) Atomically updates (with memory effects as specified by
|
addAndGet | back to summary |
---|---|
public long addAndGet(int i, long delta) Atomically adds the given value to the element at index
|
compareAndExchange | back to summary |
---|---|
public final long compareAndExchange(int i, long expectedValue, long newValue) Atomically sets the element at index
|
compareAndExchangeAcquire | back to summary |
---|---|
public final long compareAndExchangeAcquire(int i, long expectedValue, long newValue) Atomically sets the element at index
|
compareAndExchangeRelease | back to summary |
---|---|
public final long compareAndExchangeRelease(int i, long expectedValue, long newValue) Atomically sets the element at index
|
compareAndSet | back to summary |
---|---|
public final boolean compareAndSet(int i, long expectedValue, long newValue) Atomically sets the element at index
|
decrementAndGet | back to summary |
---|---|
public final long decrementAndGet(int i) Atomically decrements the value of the element at index Equivalent to
|
get | back to summary |
---|---|
public final long get(int i) Returns the current value of the element at index
|
getAcquire | back to summary |
---|---|
public final long getAcquire(int i) Returns the current value of the element at index
|
getAndAccumulate | back to summary |
---|---|
public final long getAndAccumulate(int i, long x, LongBinaryOperator accumulatorFunction) Atomically updates (with memory effects as specified by
|
getAndAdd | back to summary |
---|---|
public final long getAndAdd(int i, long delta) Atomically adds the given value to the element at index
|
getAndDecrement | back to summary |
---|---|
public final long getAndDecrement(int i) Atomically decrements the value of the element at index Equivalent to
|
getAndIncrement | back to summary |
---|---|
public final long getAndIncrement(int i) Atomically increments the value of the element at index Equivalent to
|
getAndSet | back to summary |
---|---|
public final long getAndSet(int i, long newValue) Atomically sets the element at index
|
getAndUpdate | back to summary |
---|---|
public final long getAndUpdate(int i, LongUnaryOperator updateFunction) Atomically updates (with memory effects as specified by
|
getOpaque | back to summary |
---|---|
public final long getOpaque(int i) Returns the current value of the element at index
|
getPlain | back to summary |
---|---|
public final long getPlain(int i) Returns the current value of the element at index
|
incrementAndGet | back to summary |
---|---|
public final long incrementAndGet(int i) Atomically increments the value of the element at index Equivalent to
|
lazySet | back to summary |
---|---|
public final void lazySet(int i, long newValue) Sets the element at index
|
length | back to summary |
---|---|
public final int length() Returns the length of the array.
|
set | back to summary |
---|---|
public final void set(int i, long newValue) Sets the element at index
|
setOpaque | back to summary |
---|---|
public final void setOpaque(int i, long newValue) Sets the element at index
|
setPlain | back to summary |
---|---|
public final void setPlain(int i, long newValue) Sets the element at index
|
setRelease | back to summary |
---|---|
public final void setRelease(int i, long newValue) Sets the element at index
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns the String representation of the current values of array.
|
updateAndGet | back to summary |
---|---|
public final long updateAndGet(int i, LongUnaryOperator updateFunction) Atomically updates (with memory effects as specified by
|
weakCompareAndSet | back to summary |
---|---|
public final boolean weakCompareAndSet(int i, long expectedValue, long newValue)
Deprecated since 9. This method has plain memory effects but the method
name implies volatile memory effects (see methods such as
Possibly atomically sets the element at index
|
weakCompareAndSetAcquire | back to summary |
---|---|
public final boolean weakCompareAndSetAcquire(int i, long expectedValue, long newValue) Possibly atomically sets the element at index
|
weakCompareAndSetPlain | back to summary |
---|---|
public final boolean weakCompareAndSetPlain(int i, long expectedValue, long newValue) Possibly atomically sets the element at index
|
weakCompareAndSetRelease | back to summary |
---|---|
public final boolean weakCompareAndSetRelease(int i, long expectedValue, long newValue) Possibly atomically sets the element at index
|
weakCompareAndSetVolatile | back to summary |
---|---|
public final boolean weakCompareAndSetVolatile(int i, long expectedValue, long newValue) Possibly atomically sets the element at index
|