public class AtomicBoolean extends Object
| Constructor and Description |
|---|
AtomicBoolean(boolean initialValue)
Creates a new AtomicBoolean with the given initial value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAndSet(boolean expect,
boolean update)
Atomically set the value to the given updated value
if the current value == the expected value.
|
boolean |
get()
Returns the current value.
|
void |
set(boolean value)
Unconditionally sets to the given value.
|
public AtomicBoolean(boolean initialValue)
initialValue - the initial valuepublic boolean get()
public void set(boolean value)
newValue - the new valuepublic boolean compareAndSet(boolean expect,
boolean update)
expect - the expected valueupdate - the new valueCopyright © 2016. All rights reserved.