java.lang.Object | ||
↳ | java.lang.Number | |
↳ | java.util.concurrent.atomic.AtomicInteger |
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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new AtomicInteger with the given initial value.
| |||||||||||
Create a new AtomicInteger with initial value 0.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Atomically add the given value to current value.
| |||||||||||
Atomically set the value to the given updated value
if the current value == the expected value.
| |||||||||||
Atomically decrement by one the current value.
| |||||||||||
Returns this object's value as a double.
| |||||||||||
Returns this object's value as a float.
| |||||||||||
Get the current value.
| |||||||||||
Atomically add the given value to current value.
| |||||||||||
Atomically decrement by one the current value.
| |||||||||||
Atomically increment by one the current value.
| |||||||||||
Set to the give value and return the old value.
| |||||||||||
Atomically increment by one the current value.
| |||||||||||
Returns this object's value as an int.
| |||||||||||
Returns this object's value as a long.
| |||||||||||
Set to the given value.
| |||||||||||
Returns the String representation of the current value.
| |||||||||||
Atomically set the value to the given updated value
if the current value == the expected value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Number
| |||||||||||
From class java.lang.Object
|
Create a new AtomicInteger with the given initial value.
initialValue | the initial value |
---|
Create a new AtomicInteger with initial value 0.
Atomically add the given value to current value.
delta | the value to add |
---|
Atomically set the value to the given updated value if the current value == the expected value.
expect | the expected value |
---|---|
update | the new value |
Atomically decrement by one the current value.
Returns this object's value as a double. Might involve rounding.
Returns this object's value as a float. Might involve rounding.
Get the current value.
Atomically add the given value to current value.
delta | the value to add |
---|
Atomically decrement by one the current value.
Atomically increment by one the current value.
Set to the give value and return the old value.
newValue | the new value |
---|
Atomically increment by one the current value.
Returns this object's value as an int. Might involve rounding and/or truncating the value, so it fits into an int.
Returns this object's value as a long. Might involve rounding and/or truncating the value, so it fits into a long.
Set to the given value.
newValue | the new value |
---|
Returns the String representation of the current value.
Atomically set the value to the given updated value if the current value == the expected value. May fail spuriously.
expect | the expected value |
---|---|
update | the new value |