本文整理了Java中rx.Observable.last()
方法的一些代码示例,展示了Observable.last()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.last()
方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:last
[英]Returns an Observable that emits the last item emitted by the source Observable or notifies observers of a NoSuchElementException if the source Observable is empty.
Scheduler: last does not operate by default on a particular Scheduler.
[中]返回一个Observable,该Observable发出源Observable发出的最后一项,或者如果源Observable为空,则通知观察者NosTouchElementException。
调度程序:默认情况下,last不会在特定调度程序上运行。
代码示例来源: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: apache/usergrid
.repairSources( scope, targetPair.id, targetPair.edgeType, maxVersion ) ).last();
.repairTargets( scope, targetPair.id, targetPair.edgeType, maxVersion ) ).last();
代码示例来源:origin: com.microsoft.azure/azure-mgmt-sql
@Override
public Observable<Indexable> call(final Context context) {
return storageAccountCreatable.createAsync()
.last()
.flatMap(new Func1<Indexable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Indexable storageAccount) {
return getOrCreateStorageAccountContainer((StorageAccount) storageAccount, containerName, fileName, context);
}
});
}
});
代码示例来源:origin: com.microsoft.azure/azure-mgmt-containerservice
@Override
public Observable<ManagedClusterInner> call(final ManagedClusterInner managedClusterInner) {
return Observable.merge(adminConfig, userConfig).last()
.map(new Func1<byte[], ManagedClusterInner>() {
@Override
public ManagedClusterInner call(byte[] bytes) {
return managedClusterInner;
}
});
}
});
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<ManagedClusterInner> call(final ManagedClusterInner managedClusterInner) {
return Observable.merge(adminConfig, userConfig).last()
.map(new Func1<byte[], ManagedClusterInner>() {
@Override
public ManagedClusterInner call(byte[] bytes) {
return managedClusterInner;
}
});
}
});
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<Indexable> call(final Context context) {
return storageAccountCreatable.createAsync()
.last()
.flatMap(new Func1<Indexable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Indexable storageAccount) {
return getOrCreateStorageAccountContainer((StorageAccount) storageAccount, containerName, fileName, context);
}
});
}
});
代码示例来源:origin: com.microsoft.azure/azure-mgmt-resources
@Override
public Observable<FluentModelT> executeAsync() {
return taskGroup.invokeAsync(taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: com.microsoft.azure/azure-mgmt-resources
@Override
public Observable<FluentModelT> applyAsync() {
return taskGroup.invokeAsync(this.taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: com.microsoft.azure/azure-arm-client-runtime
@Override
public Observable<FluentModelT> executeAsync() {
return taskGroup.invokeAsync(taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: com.microsoft.azure/azure-arm-client-runtime
@Override
public Observable<FluentModelT> applyAsync() {
return taskGroup.invokeAsync(this.taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<FluentModelT> applyAsync() {
return taskGroup.invokeAsync(this.taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<FluentModelT> executeAsync() {
return taskGroup.invokeAsync(taskGroup.newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<Indexable> call(Context context) {
return submitAppSettings().mergeWith(submitConnectionStrings())
.last().flatMap(new Func1<Indexable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(Indexable indexable) {
return submitStickiness();
}
});
}
});
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<String> streamTraceLogsAsync() {
return functionService.ping()
.mergeWith(functionService.getHostStatus())
.last()
.flatMap(new Func1<Void, Observable<String>>() {
@Override
public Observable<String> call(Void aVoid) {
return FunctionAppImpl.super.streamTraceLogsAsync();
}
});
}
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<String> streamDeploymentLogsAsync() {
return functionService.ping()
.mergeWith(functionService.getHostStatus())
.last()
.flatMap(new Func1<Void, Observable<String>>() {
@Override
public Observable<String> call(Void aVoid) {
return FunctionAppImpl.super.streamDeploymentLogsAsync();
}
});
}
代码示例来源:origin: Azure/azure-libraries-for-java
@Override
public Observable<String> streamApplicationLogsAsync() {
return functionService.ping()
.mergeWith(functionService.getHostStatus())
.last()
.flatMap(new Func1<Void, Observable<String>>() {
@Override
public Observable<String> call(Void aVoid) {
return FunctionAppImpl.super.streamApplicationLogsAsync();
}
});
}
代码示例来源:origin: org.springframework.data/spring-data-couchbase
@SuppressWarnings("unchecked")
@Override
public Mono<Void> deleteAll(Iterable<? extends T> entities) {
Assert.notNull(entities, "The given Iterable of entities must not be null!");
return mapMono(operations
.remove(entities)
.last()
.map(res -> Observable.<Void>empty()).toSingle());
}
代码示例来源:origin: spring-projects/spring-data-couchbase
@SuppressWarnings("unchecked")
@Override
public Mono<Void> deleteAll(Iterable<? extends T> entities) {
Assert.notNull(entities, "The given Iterable of entities must not be null!");
return mapMono(operations
.remove(entities)
.last()
.map(res -> Observable.<Void>empty()).toSingle());
}
代码示例来源:origin: com.microsoft.azure/azure-mgmt-resources
@Override
public Observable<FluentModelT> applyAsync() {
return taskGroup().invokeAsync(this.taskGroup().newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
代码示例来源:origin: com.microsoft.azure/azure-arm-client-runtime
@Override
public Observable<FluentModelT> applyAsync() {
return taskGroup().invokeAsync(this.taskGroup().newInvocationContext())
.last()
.map(new Func1<Indexable, FluentModelT>() {
@Override
public FluentModelT call(Indexable indexable) {
return (FluentModelT) indexable;
}
});
}
内容来源于网络,如有侵权,请联系作者删除!