Skip to content

修正 Java 10 中的 Optional 增强描述 #2691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

x0c
Copy link
Contributor

@x0c x0c commented Jul 3, 2025

Java8 中 Optional 已经包含 orElseThrow(Supplier) 方法,但没有无参的 orElseThrow(),到 Java 10 引入了无参的 orElseThrow() 方法。并非原文所述 orElseThrow() 方法是 Java 10 才出现的。

参考:https://github.com/openjdk/jdk/blob/jdk-10%2B46/src/java.base/share/classes/java/util/Optional.java#L369

@Snailclimb Snailclimb merged commit 1ccf42f into Snailclimb:main Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants