java.lang.Object | |
↳ | java.util.concurrent.atomic.AtomicBoolean |
A
boolean
value that may be updated atomically. See the
java.util.concurrent.atomic
package specification for
description of the properties of atomic variables. An
AtomicBoolean
is used in applications such as atomically
updated flags, and cannot be used as a replacement for a
Boolean
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Creates a new
AtomicBoolean
with the given initial value.
|
||||||||||
|
Creates a new
AtomicBoolean
with initial value
false
.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Atomically sets the value to the given updated value
if the current value
==
the expected value.
|
||||||||||
|
Returns the current value.
|
||||||||||
|
Atomically sets to the given value and returns the previous value.
|
||||||||||
|
Eventually sets to the given value.
|
||||||||||
|
Unconditionally sets to the given value.
|
||||||||||
|
Returns the String representation of the current value.
|
||||||||||
|
Atomically sets the value to the given updated value
if the current value
==
the expected value.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a new
AtomicBoolean
with the given initial value.
initialValue | the initial value |
---|
Atomically sets the value to the given updated value
if the current value
==
the expected value.
expect | the expected value |
---|---|
update | the new value |
Returns the current value.
Atomically sets to the given value and returns the previous value.
newValue | the new value |
---|
Eventually sets to the given value.
newValue | the new value |
---|
Unconditionally sets to the given value.
newValue | the new value |
---|
Returns the String representation of the current value.
Atomically sets the value to the given updated value
if the current value
==
the expected value.
May fail
spuriously and does not provide ordering guarantees
, so is
only rarely an appropriate alternative to
compareAndSet
.
expect | the expected value |
---|---|
update | the new value |