CompletionStage,CompletableFuture无效-返回什么?

问题描述 投票:1回答:1

这是我的方法:

public CompletionStage<Void> insert(List<HashAction> hashActionList) {
    if(!hashActionList.isEmpty()) {
        return ...
    }
    // what to return here ?
}

如果清单为空,我不知道要返回什么。不知道null是否是好的,因为之后我将不得不检查null。

我尝试过

return CompletableFuture.completedFuture(null);

但是我并不确定,因为我随机选择了一个CompletionStage实现。>

这里是我的方法:public CompletionStage insert(List hashActionList){if(!hashActionList.isEmpty()){return ...} //这里返回什么? } I ...

java reactive-programming reactive completable-future
1个回答
0
投票

您仅可以通过具有空的异步运行方法来返回CompletableFuture<Void>

© www.soinside.com 2019 - 2024. All rights reserved.