本文整理了Java中rx.Observable.toSingle()
方法的一些代码示例,展示了Observable.toSingle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.toSingle()
方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:toSingle
暂无
代码示例来源:origin: lettuce-io/lettuce-core
@Override
public Single<?> apply(Observable<?> source) {
return source.toSingle();
}
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public <T> Single<T> getObjectSingle(Class<T> objectClass) {
return getObjectObservable(objectClass).toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public Single<JSONArray> getJSONArraySingle() {
return getJSONArrayObservable().toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public <T> Single<T> getParseSingle(TypeToken<T> typeToken) {
return getParseObservable(typeToken).toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public <T> Single<List<T>> getObjectListSingle(Class<T> objectClass) {
return getObjectListObservable(objectClass).toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public Single<JSONObject> getJSONObjectSingle() {
return getJSONObjectObservable().toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public Single<Bitmap> getBitmapSingle() {
return getBitmapObservable().toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public Single<String> getStringSingle() {
return getStringObservable().toSingle();
}
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
public Single<String> getDownloadSingle() {
return getDownloadObservable().toSingle();
}
代码示例来源:origin: ReactiveX/RxNetty
public SingleHostConnectionProvider(Observable<HostConnector<W, R>> connectors) {
connectors.toSingle()
.subscribe(new Action1<HostConnector<W, R>>() {
@Override
public void call(HostConnector<W, R> connector) {
provider = connector.getConnectionProvider();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable t) {
logger.error("Failed while fetching a host connector from a scalar host source", t);
}
});
}
代码示例来源:origin: PipelineAI/pipeline
private Object mapObservable(Observable observable, final MetaHolder metaHolder) {
if (Completable.class.isAssignableFrom(metaHolder.getMethod().getReturnType())) {
return observable.toCompletable();
} else if (Single.class.isAssignableFrom(metaHolder.getMethod().getReturnType())) {
return observable.toSingle();
}
return observable;
}
代码示例来源:origin: jeasonlzy/okhttp-OkGo
@Override
public Single<Result<T>> adapt(Call<T> call, AdapterParam param) {
ObservableResult<T> body = new ObservableResult<>();
return body.adapt(call, param).toSingle();
}
}
代码示例来源:origin: jeasonlzy/okhttp-OkGo
@Override
public Single<T> adapt(Call<T> call, AdapterParam param) {
ObservableBody<T> body = new ObservableBody<>();
return body.adapt(call, param).toSingle();
}
}
代码示例来源:origin: jeasonlzy/okhttp-OkGo
@Override
public Single<Response<T>> adapt(Call<T> call, AdapterParam param) {
ObservableResponse<T> body = new ObservableResponse<>();
return body.adapt(call, param).toSingle();
}
}
代码示例来源:origin: square/retrofit
@Override public Object adapt(Call<R> call) {
OnSubscribe<Response<R>> callFunc = isAsync
? new CallEnqueueOnSubscribe<>(call)
: new CallExecuteOnSubscribe<>(call);
OnSubscribe<?> func;
if (isResult) {
func = new ResultOnSubscribe<>(callFunc);
} else if (isBody) {
func = new BodyOnSubscribe<>(callFunc);
} else {
func = callFunc;
}
Observable<?> observable = Observable.create(func);
if (scheduler != null) {
observable = observable.subscribeOn(scheduler);
}
if (isSingle) {
return observable.toSingle();
}
if (isCompletable) {
return observable.toCompletable();
}
return observable;
}
}
代码示例来源:origin: vert-x3/vertx-examples
private void insertAndFind() {
// Documents to insert
Observable<JsonObject> documents = Observable.just(
new JsonObject().put("username", "temporalfox").put("firstname", "Julien").put("password", "bilto"),
new JsonObject().put("username", "purplefox").put("firstname", "Tim").put("password", "wibble")
);
mongo.rxCreateCollection("users").flatMapObservable(v -> {
// After collection is created we insert each document
return documents.flatMap(doc -> mongo.rxInsert("users", doc).toObservable());
}).doOnNext(id -> {
System.out.println("Inserted document " + id);
}).last().toSingle().flatMap(id -> {
// Everything has been inserted now we can query mongo
System.out.println("Insertions done");
return mongo.rxFind("users", new JsonObject());
}).subscribe(results -> {
System.out.println("Results " + results);
}, error -> {
System.out.println("Err");
error.printStackTrace();
});
}
}
代码示例来源:origin: PipelineAI/pipeline
Single<User> singleUserRxFallback(final String id, final String name) {
return createObservable("default_id", "default_name").toSingle();
}
代码示例来源:origin: PipelineAI/pipeline
@HystrixCommand
public Single<User> getSingleUser(final String id, final String name) {
validate(id, name, "getSingleUser has failed");
return createObservable(id, name).toSingle();
}
代码示例来源:origin: Netflix/EVCache
.doOnSuccess(fbData -> increment(fbClient.getServerGroupName(), _cacheName, "RETRY_" + ((fbData == null) ? "MISS" : "HIT")))
.toObservable()))
.firstOrDefault(null, fbData -> (fbData != null)).toSingle();
代码示例来源:origin: Netflix/EVCache
.doOnSuccess(fbData -> increment(fbClient.getServerGroupName(), _cacheName, "RETRY_" + ((fbData == null) ? "MISS" : "HIT")))
.toObservable()))
.firstOrDefault(null, fbData -> (fbData != null)).toSingle();
内容来源于网络,如有侵权,请联系作者删除!