Name
AtomicBoolean
Synopsis
This threadsafe class holds a boolean value. In
addition to the get( )
and set(
)
iterators, it provides atomic compareAndSet(
)
, weakCompareAndSet( )
, and
getAndSet( )
operations.
Figure 16-97. java.util.concurrent.atomic.AtomicBoolean
public class AtomicBoolean implements Serializable { // Public Constructors public AtomicBoolean( ); public AtomicBoolean(boolean initialValue); // Public Instance Methods public final boolean compareAndSet(boolean expect, boolean update); public final boolean get( ); public final boolean getAndSet(boolean newValue); public final void set(boolean newValue); public boolean weakCompareAndSet(boolean expect, boolean update); // Public Methods Overriding Object public String toString( ); }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.