Android Guides | Samples

Java.Util.Concurrent.Atomic.AtomicInteger Class

An int value that may be updated atomically.

See Also: AtomicInteger

Syntax

[Android.Runtime.Register("java/util/concurrent/atomic/AtomicInteger", DoNotGenerateAcw=true)]
public class AtomicInteger : Number, IDisposable

Remarks

An int value that may be updated atomically. See the Java.Util.Concurrent.Atomic package specification for description of the properties of atomic variables. An AtomicInteger is used in applications such as atomically incremented counters, and cannot be used as a replacement for an Integer. However, this class does extend Number to allow uniform access by tools and utilities that deal with numerically-based classes.

[Android Documentation]

Requirements

Namespace: Java.Util.Concurrent.Atomic
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Java.Util.Concurrent.Atomic.AtomicInteger are listed below.

See Also: Number

Public Constructors

Creates a new AtomicInteger with initial value 0.
Creates a new AtomicInteger with the given initial value.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
AndDecrementInt32. Atomically decrements by one the current value.
[read-only]
AndIncrementInt32. Atomically increments by one the current value.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddAndGet(Int32) : Int32
Atomically adds the given value to the current value.
CompareAndSet(Int32, Int32) : Boolean
Atomically sets the value to the given updated value if the current value == the expected value.
DecrementAndGet() : Int32
Atomically decrements by one the current value.
override
DoubleValue() : Double
Returns the value of this AtomicInteger as a double after a widening primitive conversion.
override
FloatValue() : Single
Returns the value of this AtomicInteger as a float after a widening primitive conversion.
Get() : Int32
Gets the current value.
GetAndAdd(Int32) : Int32
Atomically adds the given value to the current value.
GetAndSet(Int32) : Int32
Atomically sets to the given value and returns the old value.
IncrementAndGet() : Int32
Atomically increments by one the current value.
override
IntValue() : Int32
Returns the value of this AtomicInteger as an int.
LazySet(Int32)
Eventually sets to the given value.
override
LongValue() : Int64
Returns the value of this AtomicInteger as a long after a widening primitive conversion.
Set(Int32)
Sets to the given value.
WeakCompareAndSet(Int32, Int32) : Boolean
Atomically sets the value to the given updated value if the current value == the expected value.