Java Code Examples for io.reactivex.Flowable#range()
The following examples show how to use
io.reactivex.Flowable#range() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowableMatchTest.java From rxjava2-extras with Apache License 2.0 | 6 votes |
@Test public void testLongReversed() { for (int n = 1; n < 1000; n++) { final int N = n; Flowable<Integer> a = Flowable.range(1, n).map(new Function<Integer, Integer>() { @Override public Integer apply(Integer x) { return N + 1 - x; } }); Flowable<Integer> b = Flowable.range(1, n); boolean equals = Flowable.sequenceEqual(matchThem(a, b).sorted(), Flowable.range(1, n)) .blockingGet(); assertTrue(equals); } }
Example 2
Source File: BlockingOperators.java From Learn-Java-12-Programming with MIT License | 5 votes |
private static void flowableBlocking(){ Flowable<Integer> obs = Flowable.range(1,5); Double d2 = obs.filter(i -> i % 2 == 0) .doOnNext(System.out::println) //prints 2 and 4 .map(Math::sqrt) .delay(100, TimeUnit.MILLISECONDS) .blockingLast(); System.out.println(d2); //prints: 2.0 }
Example 3
Source File: FlowableMatchTest.java From rxjava2-extras with Apache License 2.0 | 5 votes |
private void testShifted(int n, boolean async) { Flowable<Integer> a = Flowable.just(0).concatWith(Flowable.range(1, n)); if (async) { a = a.subscribeOn(Schedulers.computation()); } Flowable<Integer> b = Flowable.range(1, n); assertTrue(Flowable.sequenceEqual(matchThem(a, b), Flowable.range(1, n)).blockingGet()); }
Example 4
Source File: RxJavaHooksUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void givenFlowable_whenAssembled_shouldExecuteTheHook() { RxJavaPlugins.setOnFlowableAssembly(flowable -> { hookCalled = true; return flowable; }); Flowable.range(1, 10); assertTrue(hookCalled); }
Example 5
Source File: ProducingBean.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("data") public Publisher<Integer> source() { return Flowable.range(0, 10); }
Example 6
Source File: DynamicTopicProducingBean.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("dyn-data") public Publisher<Integer> source() { return Flowable.range(0, 10); }
Example 7
Source File: MetadataPropagationTest.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("source") public Flowable<Integer> source() { return Flowable.range(0, 10); }
Example 8
Source File: ProducingMessageWithHeaderBean.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("data") public Publisher<Integer> source() { return Flowable.range(0, 10); }
Example 9
Source File: ProducingBean.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("data") public Publisher<Integer> source() { return Flowable.range(0, 10); }
Example 10
Source File: ProducingKafkaMessageBean.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Outgoing("data") public Publisher<Integer> source() { return Flowable.range(0, 10); }
Example 11
Source File: PublisherFlatMapPerf.java From akarnokd-misc with Apache License 2.0 | 3 votes |
@Setup public void setup() { baseline = Flowable.range(1, count); justFlatMapRange = Flowable.just(1).flatMap(v -> Flowable.range(v, count)); Integer[] arr = new Integer[count]; Arrays.fill(arr, 777); justFlatMapArray = Flowable.just(1).flatMap(v -> Flowable.fromArray(arr)); rangeFlatMapJust = Flowable.range(1, count).flatMap(v -> Flowable.just(v)); }