Search in sources :

Example 1 with Streamable

use of cyclops.companion.Streamable in project cyclops by aol.

the class BatchingRSTest method onePer.

@Test
public void onePer() {
    SimpleTimer timer = new SimpleTimer();
    System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()));
    assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()).size(), is(6));
    assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
Also used : SimpleTimer(com.oath.cyclops.util.SimpleTimer) Streamable(cyclops.companion.Streamable) Test(org.junit.Test)

Example 2 with Streamable

use of cyclops.companion.Streamable in project cyclops by aol.

the class ZippingTest method testUnzip3.

@Test
public void testUnzip3() {
    Supplier<Streamable<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
    Tuple3<Streamable<Integer>, Streamable<String>, Streamable<Long>> u1 = Streamable.unzip3(s.get());
    assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
    assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}
Also used : Tuple3(cyclops.data.tuple.Tuple3) Streamable(cyclops.companion.Streamable) Test(org.junit.Test)

Example 3 with Streamable

use of cyclops.companion.Streamable in project cyclops by aol.

the class ZippingTest method testUnzip4.

@Test
public void testUnzip4() {
    Supplier<Streamable<Tuple4<Integer, String, Long, Character>>> s = () -> of(new Tuple4(1, "a", 2l, 'z'), new Tuple4(2, "b", 3l, 'y'), new Tuple4(3, "c", 4l, 'x'));
    Tuple4<Streamable<Integer>, Streamable<String>, Streamable<Long>, Streamable<Character>> u1 = Streamable.unzip4(s.get());
    assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
    assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
    assertTrue(u1._4().toList().containsAll(asList('z', 'y', 'x')));
}
Also used : Tuple4(cyclops.data.tuple.Tuple4) Streamable(cyclops.companion.Streamable) Test(org.junit.Test)

Example 4 with Streamable

use of cyclops.companion.Streamable in project cyclops by aol.

the class BatchingRSTest method onePer.

@Test
public void onePer() {
    SimpleTimer timer = new SimpleTimer();
    System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()));
    assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()).size(), is(6));
    assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
Also used : SimpleTimer(com.oath.cyclops.util.SimpleTimer) Streamable(cyclops.companion.Streamable) Test(org.junit.Test)

Example 5 with Streamable

use of cyclops.companion.Streamable in project cyclops by aol.

the class BatchingRSTest method onePer.

@Test
public void onePer() {
    SimpleTimer timer = new SimpleTimer();
    System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()));
    assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).to(Streamable::fromStream).collect(Collectors.toList()).size(), is(6));
    assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
Also used : SimpleTimer(com.oath.cyclops.util.SimpleTimer) Streamable(cyclops.companion.Streamable) Test(org.junit.Test)

Aggregations

Streamable (cyclops.companion.Streamable)7 Test (org.junit.Test)7 SimpleTimer (com.oath.cyclops.util.SimpleTimer)3 Tuple3 (cyclops.data.tuple.Tuple3)2 Tuple4 (cyclops.data.tuple.Tuple4)2