use of cyclops.futurestream.FutureStream in project cyclops by aol.
the class LazySeqTest method testZipWithFuturesStream.
@Test
public void testZipWithFuturesStream() {
Stream stream = of("a", "b");
FutureStream<Tuple2<Integer, String>> seq = of(1, 2).actOnFutures().zip(stream);
// .map(tuple -> Tuple.tuple(tuple.v1.join(),tuple.v2)).collect(CyclopsCollectors.toList());
List<Tuple2<Integer, String>> result = seq.block();
assertThat(result.size(), is(asList(tuple(1, "a"), tuple(2, "b")).size()));
}
use of cyclops.futurestream.FutureStream in project cyclops by aol.
the class LazySeqTest method testZipWithFutures.
@Test
public void testZipWithFutures() {
FutureStream stream = of("a", "b");
FutureStream<Tuple2<Integer, String>> seq = of(1, 2).actOnFutures().zip(stream);
// .map(tuple -> Tuple.tuple(tuple.v1.join(),tuple.v2)).collect(CyclopsCollectors.toList());
List<Tuple2<Integer, String>> result = seq.block();
System.out.println(result);
assertThat(result.size(), is(asList(tuple(1, "a"), tuple(2, "b")).size()));
}
use of cyclops.futurestream.FutureStream in project cyclops by aol.
the class BaseSequentialSeqTest method asyncSyncTest.
@Test
public void asyncSyncTest() {
FutureStream stream = of(1, 2, 3, 4).async().sync();
assertThat(stream.isAsync(), is(false));
}
use of cyclops.futurestream.FutureStream in project cyclops by aol.
the class BaseSequentialSeqTest method syncAndAsyncTest.
@Test
public void syncAndAsyncTest() {
FutureStream stream = of(1, 2, 3, 4).sync().async();
assertThat(stream.isAsync(), is(true));
}
use of cyclops.futurestream.FutureStream in project cyclops by aol.
the class OperationsOnFuturesTest method testShuffleRandom.
@Test
public void testShuffleRandom() {
Random r = new Random();
Supplier<FutureStream<Integer>> s = () -> of(1, 2, 3);
Assert.assertEquals(3, s.get().actOnFutures().shuffle(r).toList().size());
assertThat(s.get().actOnFutures().shuffle(r).toList(), hasItems(1, 2, 3));
}
Aggregations