gpt4 book ai didi

Java 可选 : flatmap and orElseGet

转载 作者:行者123 更新时间:2023-11-29 08:24:26 26 4
gpt4 key购买 nike

<分区>

我已经编码了:

Optional.ofNullable(this.cache.get(id))
.orElseGet(this.referenceService.get(id));

问题是 this.referenceService.get返回 Optional .

所以,我收到了这条编译消息:

The method orElseGet(Supplier<? extends Reference>) in the type Optional<Reference> is not applicable for the arguments (Optional<Reference>)

有什么想法吗?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com