equal
deleted
inserted
replaced
231 */ |
231 */ |
232 public final long getAndUpdate(LongUnaryOperator updateFunction) { |
232 public final long getAndUpdate(LongUnaryOperator updateFunction) { |
233 long prev, next; |
233 long prev, next; |
234 do { |
234 do { |
235 prev = get(); |
235 prev = get(); |
236 next = updateFunction.operateAsLong(prev); |
236 next = updateFunction.applyAsLong(prev); |
237 } while (!compareAndSet(prev, next)); |
237 } while (!compareAndSet(prev, next)); |
238 return prev; |
238 return prev; |
239 } |
239 } |
240 |
240 |
241 /** |
241 /** |
250 */ |
250 */ |
251 public final long updateAndGet(LongUnaryOperator updateFunction) { |
251 public final long updateAndGet(LongUnaryOperator updateFunction) { |
252 long prev, next; |
252 long prev, next; |
253 do { |
253 do { |
254 prev = get(); |
254 prev = get(); |
255 next = updateFunction.operateAsLong(prev); |
255 next = updateFunction.applyAsLong(prev); |
256 } while (!compareAndSet(prev, next)); |
256 } while (!compareAndSet(prev, next)); |
257 return next; |
257 return next; |
258 } |
258 } |
259 |
259 |
260 /** |
260 /** |
274 public final long getAndAccumulate(long x, |
274 public final long getAndAccumulate(long x, |
275 LongBinaryOperator accumulatorFunction) { |
275 LongBinaryOperator accumulatorFunction) { |
276 long prev, next; |
276 long prev, next; |
277 do { |
277 do { |
278 prev = get(); |
278 prev = get(); |
279 next = accumulatorFunction.operateAsLong(prev, x); |
279 next = accumulatorFunction.applyAsLong(prev, x); |
280 } while (!compareAndSet(prev, next)); |
280 } while (!compareAndSet(prev, next)); |
281 return prev; |
281 return prev; |
282 } |
282 } |
283 |
283 |
284 /** |
284 /** |
298 public final long accumulateAndGet(long x, |
298 public final long accumulateAndGet(long x, |
299 LongBinaryOperator accumulatorFunction) { |
299 LongBinaryOperator accumulatorFunction) { |
300 long prev, next; |
300 long prev, next; |
301 do { |
301 do { |
302 prev = get(); |
302 prev = get(); |
303 next = accumulatorFunction.operateAsLong(prev, x); |
303 next = accumulatorFunction.applyAsLong(prev, x); |
304 } while (!compareAndSet(prev, next)); |
304 } while (!compareAndSet(prev, next)); |
305 return next; |
305 return next; |
306 } |
306 } |
307 |
307 |
308 /** |
308 /** |