本文整理了Java中io.reactivex.Flowable.delay()
方法的一些代码示例,展示了Flowable.delay()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.delay()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:delay
[英]Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay. Error notifications from the source Publisher are not delayed.
Backpressure: The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher. Scheduler: This version of delay operates by default on the computation Scheduler.
[中]返回一个FlowTable,该FlowTable发出源发布服务器发出的项,这些项在时间上向前移动了指定的延迟。来自源发布服务器的错误通知不会延迟。
背压:操作员不会干扰由源发布者确定的背压行为。调度程序:默认情况下,此版本的延迟在计算调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> apply(Boolean t1) {
return Flowable.just(2).delay(500, TimeUnit.MILLISECONDS);
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Integer> apply(Integer x) {
System.out.println("testRepeatRetarget -> " + x);
concatBase.add(x);
return Flowable.<Integer>empty()
.delay(200, TimeUnit.MILLISECONDS);
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> apply(Boolean t1) {
return Flowable.just(2).delay(500, TimeUnit.MILLISECONDS);
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingLatest().iterator().hasNext();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingIterable().iterator().next();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingNext().iterator().hasNext();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Integer> apply(Integer i) throws Exception {
return i == 3 ? Flowable.just(i) : Flowable
.just(i)
.delay(1, TimeUnit.MILLISECONDS, Schedulers.io());
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).toFuture().get();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Object> apply(Flowable<Object> f) throws Exception {
return f.delay(Functions.justFunction(Flowable.never()));
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingLast();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingLast();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void delayWithFunctionReturnsNull() {
just1.delay(new Function<Integer, Publisher<Object>>() {
@Override
public Publisher<Object> apply(Integer v) {
return null;
}
}).blockingSubscribe();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void delayBothItemSupplierReturnsNull() {
just1.delay(just1, new Function<Integer, Publisher<Object>>() {
@Override
public Publisher<Object> apply(Integer v) {
return null;
}
}).blockingSubscribe();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
return Flowable.just(2).delay(100, TimeUnit.MILLISECONDS).blockingLast();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingFirst();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Test
public void itemDelayReturnsNull() {
Flowable.just(1).delay(new Function<Integer, Publisher<Object>>() {
@Override
public Publisher<Object> apply(Integer t) throws Exception {
return null;
}
})
.test()
.assertFailureAndMessage(NullPointerException.class, "The itemDelay returned a null Publisher");
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void awaitCountLess3() {
Flowable.range(1, 4).delay(50, TimeUnit.MILLISECONDS)
.test()
.awaitCount(5, TestWaitStrategy.SLEEP_1MS)
.assertResult(1, 2, 3, 4);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void skipLastTimedCustomSchedulerDelayError() {
Flowable.just(1).concatWith(Flowable.just(2).delay(500, TimeUnit.MILLISECONDS))
.skipLast(300, TimeUnit.MILLISECONDS, Schedulers.io(), true)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void skipLastTimedDefaultScheduler() {
Flowable.just(1).concatWith(Flowable.just(2).delay(500, TimeUnit.MILLISECONDS))
.skipLast(300, TimeUnit.MILLISECONDS)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delayWithTimeDelayError() throws Exception {
Flowable.just(1).concatWith(Flowable.<Integer>error(new TestException()))
.delay(100, TimeUnit.MILLISECONDS, true)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertFailure(TestException.class, 1);
}
内容来源于网络,如有侵权,请联系作者删除!