AtomicLongArray.AccumulateAndGet(Int32, Int64, ILongBinaryOperator) 方法

定义

以原子方式更新(按索引i指定的VarHandle#compareAndSet内存效果)元素,并将给定函数应用于当前值和给定值的结果,并返回更新的值。

[Android.Runtime.Register("accumulateAndGet", "(IJLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)]
public long AccumulateAndGet(int i, long x, Java.Util.Functions.ILongBinaryOperator? accumulatorFunction);
[<Android.Runtime.Register("accumulateAndGet", "(IJLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)>]
member this.AccumulateAndGet : int * int64 * Java.Util.Functions.ILongBinaryOperator -> int64

参数

i
Int32

索引

x
Int64

更新值

accumulatorFunction
ILongBinaryOperator

两个参数的无副作用函数

返回

更新的值

属性

注解

以原子方式更新(按索引i指定的VarHandle#compareAndSet内存效果)元素,并将给定函数应用于当前值和给定值的结果,并返回更新的值。 该函数应无副作用,因为当尝试更新因线程之间的争用而失败时,可能会重新应用该函数。 该函数应用索引处 i 元素的当前值作为第一个参数,并将给定更新作为第二个参数。

已在 1.8 中添加。

Java文档java.util.concurrent.atomic.AtomicLongArray.accumulateAndGet(int, long, java.util.function.LongBinaryOperator)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于