Search in sources :

Example 6 with Streamable

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

the class ZippingTest method testUnzip3WithLimits.

@Test
public void testUnzip3WithLimits() {
    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().limit(1).toList().containsAll(Arrays.asList(1)));
    assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
    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 7 with Streamable

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

the class ZippingTest method testUnzip4WithLimits.

@Test
public void testUnzip4WithLimits() {
    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().limit(1).toList().containsAll(Arrays.asList(1)));
    assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
    assertTrue(u1._3().limit(3).toList().containsAll(asList(2l, 3l, 4l)));
    assertTrue(u1._4().limit(4).toList().containsAll(asList('z', 'y', 'x')));
}
Also used : Tuple4(cyclops.data.tuple.Tuple4) 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