Java AtomicReference Class methods, constructors, variables available in Java 8 release are listed below. We will publish example program on each methods ASAP.
Constructors in Java AtomicReference Class
S.No | Constructor & Description |
---|---|
1 | AtomicReference()
Creates a new AtomicReference with null initial value.
|
2 | AtomicReference(V initialValue)
Creates a new AtomicReference with the given initial value.
|
Methods in Java AtomicReference Class
S.No | Method & Description |
---|---|
1 | V accumulateAndGet(V x, BinaryOperator<V> accumulatorFunction)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
|
2 | boolean compareAndSet(V expect, V update) Atomically sets the value to the given updated value if the current value == the expected value.
|
3 | V get()
Gets the current value.
|
4 | V getAndAccumulate(V x, BinaryOperator<V> accumulatorFunction)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the previous value.
|
5 | V getAndSet(V newValue)
Atomically sets to the given value and returns the old value.
|
6 | V getAndUpdate(UnaryOperator<V> updateFunction)
Atomically updates the current value with the results of applying the given function, returning the previous value.
|
7 | void lazySet(V newValue)
Eventually sets to the given value.
|
8 | void set(V newValue)
Sets to the given value.
|
9 | String toString()
Returns the String representation of the current value.
|
10 | V updateAndGet(UnaryOperator<V> updateFunction)
Atomically updates the current value with the results of applying the given function, returning the updated value.
|
11 | boolean weakCompareAndSet(V expect, V update)
Atomically sets the value to the given updated value if the current value == the expected value.
|
Ask your questions in eHowToNow Forum
Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers
- Java – AtomicStampedReference Class
- Java – AtomicLongArray Class
- Java – AtomicReference Class
- Java – AtomicIntegerFieldUpdater Class
- Java – AtomicReferenceArray Class
- java.util.concurrent.atomic Package
- Java – DoubleAdder Class
- Java – DoubleAccumulator Class
- Java – AtomicBoolean Class
- Java – LongAccumulator Class
- Java – AtomicIntegerArray Class
- Java – AtomicReferenceFieldUpdater Class
- Java – AtomicMarkableReference Class
- Java – AtomicLongFieldUpdater Class
- Java – AtomicLong Class
Leave a Reply
You must be logged in to post a comment.