use of java8.util.concurrent.atomic.LongAdder in project streamsupport by stefan-zobel.
the class SplittableRandomTest method testUnsizedLongsCount.
/**
* A parallel unsized stream of longs generates at least 100 values
*/
public void testUnsizedLongsCount() {
LongAdder counter = new LongAdder();
SplittableRandom r = new SplittableRandom();
long size = 100;
r.longs().limit(size).parallel().forEach(x -> counter.increment());
assertEquals(size, counter.sum());
}
use of java8.util.concurrent.atomic.LongAdder in project streamsupport by stefan-zobel.
the class SplittableRandomTest method testUnsizedIntsCount.
/**
* A parallel unsized stream of ints generates at least 100 values
*/
public void testUnsizedIntsCount() {
LongAdder counter = new LongAdder();
SplittableRandom r = new SplittableRandom();
long size = 100;
r.ints().limit(size).parallel().forEach(x -> counter.increment());
assertEquals(size, counter.sum());
}
use of java8.util.concurrent.atomic.LongAdder in project streamsupport by stefan-zobel.
the class ThreadLocalRandom8Test method testUnsizedDoublesCount.
/**
* A parallel unsized stream of doubles generates at least 100 values
*/
public void testUnsizedDoublesCount() {
LongAdder counter = new LongAdder();
ThreadLocalRandom r = ThreadLocalRandom.current();
long size = 100;
r.doubles().limit(size).parallel().forEach(x -> counter.increment());
assertEquals(size, counter.sum());
}
use of java8.util.concurrent.atomic.LongAdder in project streamsupport by stefan-zobel.
the class ThreadLocalRandom8Test method testUnsizedIntsCountSeq.
/**
* A sequential unsized stream of ints generates at least 100 values
*/
public void testUnsizedIntsCountSeq() {
LongAdder counter = new LongAdder();
ThreadLocalRandom r = ThreadLocalRandom.current();
long size = 100;
r.ints().limit(size).forEach(x -> counter.increment());
assertEquals(size, counter.sum());
}
use of java8.util.concurrent.atomic.LongAdder in project streamsupport by stefan-zobel.
the class ThreadLocalRandom8Test method testUnsizedLongsCount.
/**
* A parallel unsized stream of longs generates at least 100 values
*/
public void testUnsizedLongsCount() {
LongAdder counter = new LongAdder();
ThreadLocalRandom r = ThreadLocalRandom.current();
long size = 100;
r.longs().limit(size).parallel().forEach(x -> counter.increment());
assertEquals(size, counter.sum());
}
Aggregations