gpt4 book ai didi

java - 摆脱 Optional [] 字符串?

转载 作者:行者123 更新时间:2023-12-05 01:59:36 26 4
gpt4 key购买 nike

<分区>

在 Java 中的 Stackoverflow API 上使用流进行测试

    public Optional<String> getShortestTitel() {
// return the the shortest title
return stream().map(Question::getTitle).min(Comparator.comparingInt(String::length));
}

我的输出:

Optional[Check instanceof in stream]

我怎样才能去掉 Optional[]?

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