AtomicReferenceFieldUpdater.GetAndSet(Object, Object) Method

Definition

Atomically sets the field of the given object managed by this updater to the given value and returns the old value.

[Android.Runtime.Register("getAndSet", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetGetAndSet_Ljava_lang_Object_Ljava_lang_Object_Handler")]
public virtual Java.Lang.Object? GetAndSet (Java.Lang.Object? obj, Java.Lang.Object? newValue);
[<Android.Runtime.Register("getAndSet", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "GetGetAndSet_Ljava_lang_Object_Ljava_lang_Object_Handler")>]
abstract member GetAndSet : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object
override this.GetAndSet : Java.Lang.Object * Java.Lang.Object -> Java.Lang.Object

Parameters

obj
Object

An object whose field to get and set

newValue
Object

the new value

Returns

the previous value

Attributes

Remarks

Atomically sets the field of the given object managed by this updater to the given value and returns the old value.

Java documentation for java.util.concurrent.atomic.AtomicReferenceFieldUpdater.getAndSet(T, V).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to