本文整理了Java中rx.Observable.timestamp()
方法的一些代码示例,展示了Observable.timestamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.timestamp()
方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:timestamp
[英]Returns an Observable that emits each item emitted by the source Observable, wrapped in a Timestamped object.
Scheduler: timestamp operates by default on the immediate Scheduler.
[中]返回一个Observable,该Observable发出源Observable发出的每个项,并封装在时间戳对象中。
调度器:时间戳默认在即时调度器上运行。
代码示例来源:origin: leeowenowen/rxjava-examples
@Override
public void run() {
Observable.just(1, 2).timestamp().subscribe(new Action1<Timestamped<Integer>>() {
@Override
public void call(Timestamped<Integer> integerTimestamped) {
log("" + integerTimestamped.getValue() + " " + integerTimestamped.getTimestampMillis());
}
});
}
});
代码示例来源:origin: ladingwu/ApplicationDemo
.timestamp()
代码示例来源:origin: com.netflix.rxjava/rxjava-core
/**
* Returns an Observable that emits each item emitted by the source Observable, wrapped in a
* {@link Timestamped} object.
* <p>
* <img width="640" height="310" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/timestamp.png" alt="">
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code timestamp} operates by default on the {@code immediate} {@link Scheduler}.</dd>
* </dl>
*
* @return an Observable that emits timestamped items from the source Observable
* @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#timestamp">RxJava wiki: timestamp</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229003.aspx">MSDN: Observable.Timestamp</a>
*/
public final Observable<Timestamped<T>> timestamp() {
return timestamp(Schedulers.immediate());
}
代码示例来源:origin: SmartDengg/RxBlur
.timestamp()
.flatMap(new Func1<Timestamped<Bitmap>, Observable<Integer>>() {
@Override public Observable<Integer> call(Timestamped<Bitmap> timestamped) {
代码示例来源:origin: SmartDengg/RxBlur
.timestamp()
.flatMap(new Func1<Timestamped<GlideDrawable>, Observable<Integer>>() {
@Override public Observable<Integer> call(Timestamped<GlideDrawable> timestamped) {
代码示例来源:origin: SmartDengg/RxBlur
@Override public void loadBlurBitmap() {
.timestamp()
.flatMap(new Func1<Timestamped<Bitmap>, Observable<Integer>>() {
@Override public Observable<Integer> call(Timestamped<Bitmap> timestamped) {
代码示例来源:origin: SmartDengg/RxBlur
.timestamp()
.flatMap(new Func1<Timestamped<Bitmap>, Observable<Integer>>() {
@SuppressWarnings("deprecation") @Override
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Test
public void sample_9() throws Exception {
long startTime = System.currentTimeMillis();
Observable
.interval(7, MILLISECONDS)
.timestamp()
.sample(1, SECONDS)
.map(ts -> ts.getTimestampMillis() - startTime + "ms: " + ts.getValue())
.take(5)
.subscribe(System.out::println);
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Test
public void sample_332() throws Exception {
Observable<Long> red = interval(10, TimeUnit.MILLISECONDS);
Observable<Long> green = interval(10, TimeUnit.MILLISECONDS);
Observable.zip(
red.timestamp(),
green.timestamp(),
(r, g) -> r.getTimestampMillis() - g.getTimestampMillis()
).forEach(System.out::println);
}
内容来源于网络,如有侵权,请联系作者删除!