AtomicBoolean lazySet() method in Java with Examples
The java.util.concurrent.atomic.AtomicBoolean.lazySet() is an inbuilt method in java that updates the previous value and sets it to a new value which is passed in the parameter.
public final void lazySet(boolean newVal)
Parameters: The function accepts a single mandatory parameter newVal which is to be updated.
Return Value: The function does not returns anything.
Below programs illustrate the above function:
Previous value: false Current value: true
Previous value: true Current value: false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.