Search in sources :

Example 36 with Tuple2

use of cyclops.data.tuple.Tuple2 in project cyclops by aol.

the class ReactiveZippingRSTest method testUnzipWithLimits.

@Test
public void testUnzipWithLimits() {
    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c"));
    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
    assertTrue(u1._1().limit(2).to(Streamable::fromStream).toList().containsAll(Arrays.asList(1, 2)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}
Also used : Tuple2(cyclops.data.tuple.Tuple2) FlowableReactiveSeq(cyclops.reactive.FlowableReactiveSeq) ReactiveSeq(cyclops.reactive.ReactiveSeq) Test(org.junit.Test)

Example 37 with Tuple2

use of cyclops.data.tuple.Tuple2 in project cyclops by aol.

the class SyncZippingTest method testUnzip.

@Test
public void testUnzip() {
    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c"));
    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
    assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}
Also used : Tuple2(cyclops.data.tuple.Tuple2) FlowableReactiveSeq(cyclops.reactive.FlowableReactiveSeq) ReactiveSeq(cyclops.reactive.ReactiveSeq) Test(org.junit.Test)

Example 38 with Tuple2

use of cyclops.data.tuple.Tuple2 in project cyclops by aol.

the class AsyncZippingTest method testUnzipWithLimits.

@Test
public void testUnzipWithLimits() {
    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c"));
    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
    assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}
Also used : Tuple2(cyclops.data.tuple.Tuple2) ReactiveSeq(cyclops.reactive.ReactiveSeq) ObservableReactiveSeq(cyclops.reactive.ObservableReactiveSeq) Test(org.junit.Test)

Example 39 with Tuple2

use of cyclops.data.tuple.Tuple2 in project cyclops by aol.

the class AsyncRSZippingTest method testUnzipWithLimits.

@Test
public void testUnzipWithLimits() {
    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c"));
    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
    assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}
Also used : Tuple2(cyclops.data.tuple.Tuple2) ReactiveSeq(cyclops.reactive.ReactiveSeq) FluxReactiveSeq(cyclops.reactive.FluxReactiveSeq) Test(org.junit.Test)

Example 40 with Tuple2

use of cyclops.data.tuple.Tuple2 in project cyclops by aol.

the class AsyncRSZippingTest method testUnzip.

@Test
public void testUnzip() {
    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c"));
    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
    assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
    assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}
Also used : Tuple2(cyclops.data.tuple.Tuple2) ReactiveSeq(cyclops.reactive.ReactiveSeq) FluxReactiveSeq(cyclops.reactive.FluxReactiveSeq) Test(org.junit.Test)

Aggregations

Tuple2 (cyclops.data.tuple.Tuple2)43 Test (org.junit.Test)35 ReactiveSeq (cyclops.reactive.ReactiveSeq)23 Stream (java.util.stream.Stream)17 FutureStream (cyclops.futurestream.FutureStream)16 Tuple (cyclops.data.tuple.Tuple)10 BaseSeqTest (cyclops.futurestream.react.base.BaseSeqTest)9 Collectors (java.util.stream.Collectors)7 FlowableReactiveSeq (cyclops.reactive.FlowableReactiveSeq)6 FluxReactiveSeq (cyclops.reactive.FluxReactiveSeq)6 java.util (java.util)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 AtomicReference (java.util.concurrent.atomic.AtomicReference)6 Queue (com.oath.cyclops.async.adapters.Queue)5 Vector (cyclops.data.Vector)5 Tuple3 (cyclops.data.tuple.Tuple3)5 LazyReact (cyclops.futurestream.LazyReact)5 Streams (cyclops.companion.Streams)4 Executor (java.util.concurrent.Executor)4 Function (java.util.function.Function)4