@Test public void create() throws ExecutionException, InterruptedException { List<Integer> list = ReactiveStreams.of(1, 2, 3).toList().run().toCompletableFuture().get(); assertThat(list).containsExactly(1, 2, 3); Optional<Integer> res = ReactiveStreams.of(25).findFirst().run().toCompletableFuture().get(); assertThat(res).contains(25); Optional<?> empty = ReactiveStreams.fromIterable(Collections.emptyList()).findFirst().run() .toCompletableFuture().get(); assertThat(empty).isEmpty(); }
@SuppressWarnings("unchecked") @Override public <O> PublisherStage<O> create(Engine engine, Stage.Of stage) { Iterable<O> elements = (Iterable<O>) Objects.requireNonNull(Objects.requireNonNull(stage).getElements()); return () -> Multi.createFrom().iterable(elements); }
FromIterableStageFactory implements PublisherStageFactory<Stage.Of> { @SuppressWarnings("unchecked") @Override public <O> PublisherStage<O> create(Engine engine, Stage.Of stage) { Iterable<O> elements = (Iterable<O>) Objects.requireNonNull(Objects.requireNonNull(stage).getElements()); return () -> Multi.createFrom().iterable(elements); } }
FromIterableStageFactory implements PublisherStageFactory<Stage.Of> { @SuppressWarnings("unchecked") @Override public <O> PublisherStage<O> create(Engine engine, Stage.Of stage) { Iterable<O> elements = (Iterable<O>) Objects.requireNonNull(Objects.requireNonNull(stage).getElements()); return () -> Multi.createFrom().iterable(elements); }  }
FromIterableStageFactory implements PublisherStageFactory<Stage.Of> { @SuppressWarnings("unchecked") @Override public <O> PublisherStage<O> create(Engine engine, Stage.Of stage) { Iterable<O> elements = (Iterable<O>) Objects.requireNonNull(Objects.requireNonNull(stage).getElements()); return () -> Multi.createFrom().iterable(elements); }  @SuppressWarnings("unchecked") @Override PublisherStage<O> create(Engine engine, Stage.Of stage); }
FromIterableStageFactory implements PublisherStageFactory<Stage.Of> { @SuppressWarnings("unchecked") @Override public <O> PublisherStage<O> create(Engine engine, Stage.Of stage) { Iterable<O> elements = (Iterable<O>) Objects.requireNonNull(Objects.requireNonNull(stage).getElements()); return () -> Multi.createFrom().iterable(elements); }  @SuppressWarnings("unchecked") @Override PublisherStage<O> create(Engine engine, Stage.Of stage);  }