use of java.util.concurrent.atomic.DoubleAccumulator in project jdk8u_jdk by JetBrains.
the class Serial method testDoubleAccumulator.
static void testDoubleAccumulator() {
DoubleBinaryOperator plus = (DoubleBinaryOperator & Serializable) (x, y) -> x + y;
DoubleAccumulator a = new DoubleAccumulator(plus, 13.9d);
a.accumulate(17.5d);
DoubleAccumulator result = echo(a);
if (result.get() != a.get())
throw new RuntimeException("Unexpected value");
a.reset();
result.reset();
if (result.get() != a.get())
throw new RuntimeException("Unexpected value after reset");
checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAccumulator$SerializationProxy");
}
Aggregations