本文整理了Java中rx.subjects.Subject.asObservable()
方法的一些代码示例,展示了Subject.asObservable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.asObservable()
方法的具体详情如下:
包路径:rx.subjects.Subject
类名称:Subject
方法名:asObservable
暂无
代码示例来源:origin: THEONE10211024/RxJavaSamples
/**
* The Worker fragment has started doing it's thing
*/
@Override
public void onResume() {
super.onResume();
_masterFrag.setStream(_intStream.asObservable());
}
代码示例来源:origin: com.netflix.eureka/eureka2-client
public Observable<Interest<InstanceInfo>> interestChangeStream() {
return interestSubject.asObservable().distinctUntilChanged();
}
代码示例来源:origin: com.netflix.eureka/eureka2-core
/**
* @return a channel observable that does clean up of the previous channel every time a new channel is created
*/
protected Observable<CHANNEL> channelObservableWithCleanUp(Subject<CHANNEL, CHANNEL> channelSubject) {
final Observable<CHANNEL> channelObservable = channelSubject.asObservable()
.scan(new Func2<CHANNEL, CHANNEL, CHANNEL>() {
@Override
public CHANNEL call(CHANNEL prev, CHANNEL curr) {
if (prev != null) {
logger.info("Closing old channel {}", prev);
prev.close();
}
return curr;
}
});
channelObservable.subscribe(new NoOpSubscriber<CHANNEL>()); // eagerly start the cleanup scan
return channelObservable;
}
}
内容来源于网络,如有侵权,请联系作者删除!