<分区>
我已经编码了:
Optional.ofNullable(this.cache.get(id))
.orElseGet(this.referenceService.get(id));
问题是 this.referenceService.get
返回 Optional
.
所以,我收到了这条编译消息:
The method
orElseGet(Supplier<? extends Reference>)
in the typeOptional<Reference>
is not applicable for the arguments (Optional<Reference>
)
有什么想法吗?