語言

AtomicIntegerArray.AccumulateAndGet(Int32, Int32, IIntBinaryOperator) 方法

定義

以原子方式更新(並依指定 VarHandle#compareAndSet記憶體效果)將索引元素 i 應用於當前值與給定值,回傳更新後的值。

[Android.Runtime.Register("accumulateAndGet", "(IILjava/util/function/IntBinaryOperator;)I", "", ApiSince=24)]
public int AccumulateAndGet(int i, int x, Java.Util.Functions.IIntBinaryOperator? accumulatorFunction);
[<Android.Runtime.Register("accumulateAndGet", "(IILjava/util/function/IntBinaryOperator;)I", "", ApiSince=24)>]
member this.AccumulateAndGet : int * int * Java.Util.Functions.IIntBinaryOperator -> int

參數

i
Int32

指數

x
Int32

更新值

accumulatorFunction
IIntBinaryOperator

兩個參數的無副作用函數

傳回

更新後的數值

屬性

備註

以原子方式更新(並依指定 VarHandle#compareAndSet記憶體效果)將索引元素 i 應用於當前值與給定值,回傳更新後的值。 此函式應無副作用,因為當嘗試更新因執行緒間爭用失敗時,可重新套用此功能。 函式的第一個參數是索引元素的當前值 i ,第二個參數是給定的更新值。

新增於1.8版本。

Java 文件 java.util.concurrent.atomic.AtomicIntegerArray.accumulateAndGet(int, int, java.util.function.IntBinaryOperator)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於