jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
changeset 16011 890a7ed97f6c
parent 15267 c884f548a25f
child 18576 7a5c231327af
equal deleted inserted replaced
16010:2727163b5df5 16011:890a7ed97f6c
   217      */
   217      */
   218     public final int getAndUpdate(IntUnaryOperator updateFunction) {
   218     public final int getAndUpdate(IntUnaryOperator updateFunction) {
   219         int prev, next;
   219         int prev, next;
   220         do {
   220         do {
   221             prev = get();
   221             prev = get();
   222             next = updateFunction.operateAsInt(prev);
   222             next = updateFunction.applyAsInt(prev);
   223         } while (!compareAndSet(prev, next));
   223         } while (!compareAndSet(prev, next));
   224         return prev;
   224         return prev;
   225     }
   225     }
   226 
   226 
   227     /**
   227     /**
   236      */
   236      */
   237     public final int updateAndGet(IntUnaryOperator updateFunction) {
   237     public final int updateAndGet(IntUnaryOperator updateFunction) {
   238         int prev, next;
   238         int prev, next;
   239         do {
   239         do {
   240             prev = get();
   240             prev = get();
   241             next = updateFunction.operateAsInt(prev);
   241             next = updateFunction.applyAsInt(prev);
   242         } while (!compareAndSet(prev, next));
   242         } while (!compareAndSet(prev, next));
   243         return next;
   243         return next;
   244     }
   244     }
   245 
   245 
   246     /**
   246     /**
   260     public final int getAndAccumulate(int x,
   260     public final int getAndAccumulate(int x,
   261                                       IntBinaryOperator accumulatorFunction) {
   261                                       IntBinaryOperator accumulatorFunction) {
   262         int prev, next;
   262         int prev, next;
   263         do {
   263         do {
   264             prev = get();
   264             prev = get();
   265             next = accumulatorFunction.operateAsInt(prev, x);
   265             next = accumulatorFunction.applyAsInt(prev, x);
   266         } while (!compareAndSet(prev, next));
   266         } while (!compareAndSet(prev, next));
   267         return prev;
   267         return prev;
   268     }
   268     }
   269 
   269 
   270     /**
   270     /**
   284     public final int accumulateAndGet(int x,
   284     public final int accumulateAndGet(int x,
   285                                       IntBinaryOperator accumulatorFunction) {
   285                                       IntBinaryOperator accumulatorFunction) {
   286         int prev, next;
   286         int prev, next;
   287         do {
   287         do {
   288             prev = get();
   288             prev = get();
   289             next = accumulatorFunction.operateAsInt(prev, x);
   289             next = accumulatorFunction.applyAsInt(prev, x);
   290         } while (!compareAndSet(prev, next));
   290         } while (!compareAndSet(prev, next));
   291         return next;
   291         return next;
   292     }
   292     }
   293 
   293 
   294     /**
   294     /**