本文整理了Java中io.reactivex.Flowable.ignoreElements()
方法的一些代码示例,展示了Flowable.ignoreElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.ignoreElements()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:ignoreElements
[英]Ignores all items emitted by the source Publisher and only calls onComplete or onError.
Backpressure: This operator ignores backpressure as it doesn't emit any elements and consumes the source Publisherin an unbounded manner (i.e., no backpressure is applied to it). Scheduler: ignoreElements does not operate by default on a particular Scheduler.
[中]忽略源发布服务器发出的所有项,仅调用onComplete或onError。
背压:此操作符忽略背压,因为它不发射任何元素,并以无限制的方式消耗源发布器(即,不向其应用背压)。调度器:默认情况下,ignoreElements不会在特定的调度器上运行。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Completable apply(Flowable<Object> f)
throws Exception {
return f.ignoreElements();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Object> apply(Flowable<Object> f)
throws Exception {
return f.ignoreElements().toFlowable();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> createPublisher(final long elements) {
return
Flowable.range(1, 1000).ignoreElements().<Integer>toFlowable()
;
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testIgnoreElementsFlowable() {
Flowable<Integer> flowable = Flowable.just(1, 2, 3).ignoreElements().toFlowable();
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
verify(subscriber, never()).onNext(any(Integer.class));
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testIgnoreElements() {
Completable completable = Flowable.just(1, 2, 3).ignoreElements();
CompletableObserver observer = TestHelper.mockCompletableObserver();
completable.subscribe(observer);
verify(observer, never()).onError(any(Throwable.class));
verify(observer, times(1)).onComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public CompletableSource apply(Integer v) throws Exception {
return Flowable.range(1, 100).subscribeOn(Schedulers.computation()).ignoreElements();
}
}, false, 3).toFlowable()
代码示例来源:origin: ReactiveX/RxJava
@Override
public CompletableSource apply(Integer v) throws Exception {
return Flowable.range(1, 100).subscribeOn(Schedulers.computation()).ignoreElements();
}
}).toFlowable()
代码示例来源:origin: ReactiveX/RxJava
@Test
public void dispose() {
TestHelper.checkDisposed(Flowable.just(1).ignoreElements());
TestHelper.checkDisposed(Flowable.just(1).ignoreElements().toFlowable());
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public CompletableSource apply(Integer v) throws Exception {
return Flowable.range(1, 100).subscribeOn(Schedulers.computation()).ignoreElements();
}
}, false, 3)
代码示例来源:origin: ReactiveX/RxJava
@Override
public CompletableSource apply(Integer v) throws Exception {
return Flowable.range(1, 100).subscribeOn(Schedulers.computation()).ignoreElements();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testJustTwoEmissionsObservableThrowsError() {
TestSubscriber<String> subscriber = TestSubscriber.create();
Completable cmp = Flowable.just("First", "Second").ignoreElements();
cmp.<String>toFlowable().subscribe(subscriber);
subscriber.assertNoErrors();
subscriber.assertNoValues();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testCompletedOk() {
TestObserver<Object> to = new TestObserver<Object>();
Flowable.range(1, 10).ignoreElements().subscribe(to);
to.assertNoErrors();
to.assertNoValues();
to.assertTerminated();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testNeverObservable() {
TestSubscriber<String> subscriber = TestSubscriber.create();
Completable cmp = Flowable.<String>never().ignoreElements();
cmp.<String>toFlowable().subscribe(subscriber);
subscriber.assertNotTerminated();
subscriber.assertNoValues();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testCompletedOkFlowable() {
TestSubscriber<Object> ts = new TestSubscriber<Object>();
Flowable.range(1, 10).ignoreElements().toFlowable().subscribe(ts);
ts.assertNoErrors();
ts.assertNoValues();
ts.assertTerminated();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testJustSingleItemObservable() {
TestSubscriber<String> subscriber = TestSubscriber.create();
Completable cmp = Flowable.just("Hello World!").ignoreElements();
cmp.<String>toFlowable().subscribe(subscriber);
subscriber.assertNoValues();
subscriber.assertComplete();
subscriber.assertNoErrors();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testEmptyObservable() {
TestSubscriber<String> subscriber = TestSubscriber.create();
Completable cmp = Flowable.<String>empty().ignoreElements();
cmp.<String>toFlowable().subscribe(subscriber);
subscriber.assertNoErrors();
subscriber.assertNoValues();
subscriber.assertComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testErrorReceived() {
TestObserver<Object> to = new TestObserver<Object>();
TestException ex = new TestException("boo");
Flowable.error(ex).ignoreElements().subscribe(to);
to.assertNoValues();
to.assertTerminated();
to.assertError(TestException.class);
to.assertErrorMessage("boo");
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testErrorReceivedFlowable() {
TestSubscriber<Object> ts = new TestSubscriber<Object>();
TestException ex = new TestException("boo");
Flowable.error(ex).ignoreElements().toFlowable().subscribe(ts);
ts.assertNoValues();
ts.assertTerminated();
ts.assertError(TestException.class);
ts.assertErrorMessage("boo");
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void emptySource() {
TestSubscriber<Integer> ts = TestSubscriber.create(0L);
TestingDeferredScalarSubscriber ds = new TestingDeferredScalarSubscriber(ts);
Flowable.just(1).ignoreElements().<Integer>toFlowable().subscribe(ds); // we need a producer from upstream
ts.assertNoValues();
ts.assertNoValues();
ts.assertNoErrors();
ts.assertComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void fused() {
TestSubscriber<Integer> ts = SubscriberFusion.newTest(QueueFuseable.ANY);
Flowable.just(1).hide().ignoreElements().<Integer>toFlowable()
.subscribe(ts);
ts.assertOf(SubscriberFusion.<Integer>assertFuseable())
.assertOf(SubscriberFusion.<Integer>assertFusionMode(QueueFuseable.ASYNC))
.assertResult();
}
内容来源于网络,如有侵权,请联系作者删除!