@Test public void create() throws ExecutionException, InterruptedException { Flowable<Integer> flowable = Flowable.fromArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .subscribeOn(Schedulers.computation()); List<Integer> list = ReactiveStreams.fromPublisher(flowable).limit(5).toList().run() .toCompletableFuture().get(); assertThat(list).hasSize(5).containsExactly(1, 2, 3, 4, 5); }
@Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.Limit stage) { long limit = stage.getLimit(); return source -> (Flowable<O>) source.limit(limit); }
LimitStageFactory implements ProcessingStageFactory<Stage.Limit> { @Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.Limit stage) { long limit = stage.getLimit(); return source -> (Flowable<O>) source.limit(limit); } }
LimitStageFactory implements ProcessingStageFactory<Stage.Limit> { @Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.Limit stage) { long limit = stage.getLimit(); return source -> (Flowable<O>) source.limit(limit); }  }
LimitStageFactory implements ProcessingStageFactory<Stage.Limit> { @Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.Limit stage) { long limit = stage.getLimit(); return source -> (Flowable<O>) source.limit(limit); }  @Override ProcessingStage<I, O> create(Engine engine, Stage.Limit stage); }
LimitStageFactory implements ProcessingStageFactory<Stage.Limit> { @Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.Limit stage) { long limit = stage.getLimit(); return source -> (Flowable<O>) source.limit(limit); }  @Override ProcessingStage<I, O> create(Engine engine, Stage.Limit stage);  }