Search in sources :

Example 1 with Function0

use of org.eclipse.collections.api.block.function.Function0 in project eclipse-collections by eclipse.

the class SerialParallelLazyPerformanceTest method getIntegerListGenerators.

private MutableList<Function0<FastList<Integer>>> getIntegerListGenerators(int count, boolean shuffle) {
    Interval interval = Interval.fromTo(-(count / 2), count / 2 - 1);
    MutableList<Function0<FastList<Integer>>> generators = FastList.newList();
    generators.add(() -> {
        FastList<Integer> integers = FastList.newList(interval);
        if (shuffle) {
            integers.shuffleThis();
        }
        return integers;
    });
    return generators.shuffleThis();
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Function0(org.eclipse.collections.api.block.function.Function0) Interval(org.eclipse.collections.impl.list.Interval) IntInterval(org.eclipse.collections.impl.list.primitive.IntInterval)

Example 2 with Function0

use of org.eclipse.collections.api.block.function.Function0 in project eclipse-collections by eclipse.

the class SerialParallelPerformanceTest method getIntegerListGenerators.

private MutableList<Function0<Iterable<Integer>>> getIntegerListGenerators(int count) {
    Interval interval = Interval.fromTo(-(count / 2), count / 2 - 1);
    MutableList<Function0<Iterable<Integer>>> generators = FastList.newList();
    generators.add(() -> interval.toList().shuffleThis());
    generators.add(() -> {
        MutableList<Integer> integers = interval.toList().shuffleThis();
        return integers.toImmutable();
    });
    generators.add(interval::toSet);
    return generators.shuffleThis();
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Function0(org.eclipse.collections.api.block.function.Function0) Interval(org.eclipse.collections.impl.list.Interval) IntInterval(org.eclipse.collections.impl.list.primitive.IntInterval)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Function0 (org.eclipse.collections.api.block.function.Function0)2 Interval (org.eclipse.collections.impl.list.Interval)2 IntInterval (org.eclipse.collections.impl.list.primitive.IntInterval)2