AtomicLong lazySet() method in Java with examples
The Java.util.concurrent.atomic.AtomicLong.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.
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.
public final void lazySet(long 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 method:
Previous value: 0 Current value: 10
Previous value: 18 Current value: 200