“Bloom filter”与“Vertx: Future异步操作设计”:页面之间的差异
(页面间差异)
无编辑摘要 |
(建立內容為「=Future相关操作的设计= == AsyncResult == AsyncResult表示一个异步操作的结果,这个结果要么是成功的,要么是失败的。 <syntaxhighl…」的新頁面) |
||
第1行: | 第1行: | ||
=Future相关操作的设计= | |||
== AsyncResult == | |||
AsyncResult表示一个异步操作的结果,这个结果要么是成功的,要么是失败的。 | |||
<syntaxhighlight lang="java"> | |||
interface AsyncResult<T> { | |||
<syntaxhighlight lang=" | T getResult(); | ||
> | Throwable cause(); | ||
( | boolean succeeded(); | ||
boolean failed(); | |||
( | AsyncResult<V> map(Function<T, V> mapper); | ||
> | AsyncResult<V> map(V value); | ||
( | AsyncResult<V> mapEmpty(); | ||
> | AsyncResult<T> otherwise(T value); | ||
( | AsyncResult<T> otherwise(Function<Throwable, T> mapper); | ||
< | AsyncResult<T> otherwiseEmpty(); | ||
} | |||
< | |||
> | |||
( | |||
> | |||
( | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Vert.x]] | |||
[[Category: | |||
2021年7月25日 (日) 08:04的版本
Future相关操作的设计
AsyncResult
AsyncResult表示一个异步操作的结果,这个结果要么是成功的,要么是失败的。
interface AsyncResult<T> {
T getResult();
Throwable cause();
boolean succeeded();
boolean failed();
AsyncResult<V> map(Function<T, V> mapper);
AsyncResult<V> map(V value);
AsyncResult<V> mapEmpty();
AsyncResult<T> otherwise(T value);
AsyncResult<T> otherwise(Function<Throwable, T> mapper);
AsyncResult<T> otherwiseEmpty();
}