Search in sources :

Example 1 with ReactiveConvertableSequence

use of com.oath.cyclops.ReactiveConvertableSequence in project cyclops by aol.

the class MiscTest method pVectorX.

@Test
public void pVectorX() {
    ReactiveSeq<String> seq = Spouts.from(VectorX.of(1, 2, 3, 4).plus(5).map(i -> "connect toNested Akka, RxJava and more with reactiveBuffer-streams" + i));
    PersistentSetX<String> setX = seq.to(s -> new LazyReact().fromStream(s)).map(data -> "fan out across threads with futureStreams" + data).to(ReactiveConvertableSequence::converter).persistentSetX();
}
Also used : ListX(cyclops.reactive.collections.mutable.ListX) Arrays(java.util.Arrays) ReactiveConvertableSequence(com.oath.cyclops.ReactiveConvertableSequence) Spouts(cyclops.reactive.Spouts) LazyReact(cyclops.futurestream.LazyReact) VectorX(cyclops.reactive.collections.immutable.VectorX) Futures(cyclops.companion.Futures) Test(org.junit.Test) Future(cyclops.control.Future) Supplier(java.util.function.Supplier) Assert.assertThat(org.junit.Assert.assertThat) ReactiveSeq(cyclops.reactive.ReactiveSeq) Flux(reactor.core.publisher.Flux) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Matchers.equalTo(org.hamcrest.Matchers.equalTo) SimpleReact(cyclops.futurestream.SimpleReact) Optional(java.util.Optional) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) PersistentSetX(cyclops.reactive.collections.immutable.PersistentSetX) LazyReact(cyclops.futurestream.LazyReact) Test(org.junit.Test)

Example 2 with ReactiveConvertableSequence

use of com.oath.cyclops.ReactiveConvertableSequence in project cyclops by aol.

the class AbstractAnyMSeqTest method testShuffleRandom.

@Test
public void testShuffleRandom() {
    Random r = new Random();
    Supplier<AnyMSeq<W, Integer>> s = () -> of(1, 2, 3);
    assertEquals(3, s.get().shuffle(r).to(ReactiveConvertableSequence::converter).listX().size());
    assertThat(s.get().shuffle(r).to(ReactiveConvertableSequence::converter).listX(), hasItems(1, 2, 3));
}
Also used : Random(java.util.Random) ReactiveConvertableSequence(com.oath.cyclops.ReactiveConvertableSequence) AnyMSeq(com.oath.cyclops.anym.AnyMSeq) Test(org.junit.Test)

Aggregations

ReactiveConvertableSequence (com.oath.cyclops.ReactiveConvertableSequence)2 Test (org.junit.Test)2 AnyMSeq (com.oath.cyclops.anym.AnyMSeq)1 Futures (cyclops.companion.Futures)1 Future (cyclops.control.Future)1 LazyReact (cyclops.futurestream.LazyReact)1 SimpleReact (cyclops.futurestream.SimpleReact)1 ReactiveSeq (cyclops.reactive.ReactiveSeq)1 Spouts (cyclops.reactive.Spouts)1 PersistentSetX (cyclops.reactive.collections.immutable.PersistentSetX)1 VectorX (cyclops.reactive.collections.immutable.VectorX)1 ListX (cyclops.reactive.collections.mutable.ListX)1 Arrays (java.util.Arrays)1 Optional (java.util.Optional)1 Random (java.util.Random)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Supplier (java.util.function.Supplier)1 Matchers.equalTo (org.hamcrest.Matchers.equalTo)1 Matchers.greaterThan (org.hamcrest.Matchers.greaterThan)1 Matchers.is (org.hamcrest.Matchers.is)1