use of java.util.concurrent.atomic.LongAdder in project jdk8u_jdk by JetBrains.
the class RandomTest method testIntsCount.
/**
* A sequential sized stream of ints generates the given number of values
*/
public void testIntsCount() {
LongAdder counter = new LongAdder();
Random r = new Random();
long size = 0;
for (int reps = 0; reps < REPS; ++reps) {
counter.reset();
r.ints(size).forEach(x -> {
counter.increment();
});
assertEquals(counter.sum(), size);
size += 524959;
}
}
use of java.util.concurrent.atomic.LongAdder in project jdk8u_jdk by JetBrains.
the class RandomTest method testUnsizedDoublesCount.
/**
* A parallel unsized stream of doubles generates at least 100 values
*/
public void testUnsizedDoublesCount() {
LongAdder counter = new LongAdder();
Random r = new Random();
long size = 100;
r.doubles().limit(size).parallel().forEach(x -> {
counter.increment();
});
assertEquals(counter.sum(), size);
}
use of java.util.concurrent.atomic.LongAdder in project jdk8u_jdk by JetBrains.
the class RandomTest method testUnsizedIntsCountSeq.
/**
* A sequential unsized stream of ints generates at least 100 values
*/
public void testUnsizedIntsCountSeq() {
LongAdder counter = new LongAdder();
Random r = new Random();
long size = 100;
r.ints().limit(size).forEach(x -> {
counter.increment();
});
assertEquals(counter.sum(), size);
}
use of java.util.concurrent.atomic.LongAdder in project jdk8u_jdk by JetBrains.
the class RandomTest method testLongsCount.
/**
* A sequential sized stream of longs generates the given number of values
*/
public void testLongsCount() {
LongAdder counter = new LongAdder();
Random r = new Random();
long size = 0;
for (int reps = 0; reps < REPS; ++reps) {
counter.reset();
r.longs(size).forEach(x -> {
counter.increment();
});
assertEquals(counter.sum(), size);
size += 524959;
}
}
use of java.util.concurrent.atomic.LongAdder in project jdk8u_jdk by JetBrains.
the class SplittableRandomTest method testUnsizedDoublesCountSeq.
/**
* A sequential unsized stream of doubles generates at least 100 values
*/
public void testUnsizedDoublesCountSeq() {
LongAdder counter = new LongAdder();
SplittableRandom r = new SplittableRandom();
long size = 100;
r.doubles().limit(size).forEach(x -> {
counter.increment();
});
assertEquals(counter.sum(), size);
}
Aggregations