Search in sources :

Example 1 with MaxActive

use of com.oath.cyclops.react.collectors.lazy.MaxActive in project cyclops by aol.

the class ReactToList method main.

public static void main(String[] args) {
    List<Integer> values = new ArrayList();
    for (int i = 0; i < 4000; i++) values.add(i);
    LazyReact lazy = LazyReact.sequentialCurrentBuilder().withAsync(false).withMaxActive(new MaxActive(4010, 1000));
    SimpleTimer t = new SimpleTimer();
    for (int x = 0; x < 1000; x++) {
        res = lazy.from(values).map(i -> i + 2).map(i -> i * 3).collect(Collectors.toList());
    }
    System.out.println(t.getElapsedNanoseconds());
}
Also used : List(java.util.List) LazyReact(cyclops.futurestream.LazyReact) MaxActive(com.oath.cyclops.react.collectors.lazy.MaxActive) Test(org.junit.Test) Collectors(java.util.stream.Collectors) SimpleTimer(com.oath.cyclops.util.SimpleTimer) ArrayList(java.util.ArrayList) LazyReact(cyclops.futurestream.LazyReact) SimpleTimer(com.oath.cyclops.util.SimpleTimer) ArrayList(java.util.ArrayList) MaxActive(com.oath.cyclops.react.collectors.lazy.MaxActive)

Aggregations

MaxActive (com.oath.cyclops.react.collectors.lazy.MaxActive)1 SimpleTimer (com.oath.cyclops.util.SimpleTimer)1 LazyReact (cyclops.futurestream.LazyReact)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Test (org.junit.Test)1