[wpiutil java] Add an Option type - #9290
Conversation
Uses an ADT with subtypes `Some(T)` and `None()`, following typical naming practices from other languages Key difference from `java.util.Optional` is that there's no unsafe `get()` method that can be called. `getOrThrow()` exists to make it clear that an exception will be thrown if there's no value. Users can also use pattern matching instanceof or switch expressions on the ADT types, which j.u.Optional does not provide.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4de71048f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Should this PR also switch things currently using |
It's intentionally left for a followup PR |
Uses an ADT with subtypes
Some(T)andNone(), following typical naming practices from other languagesKey difference from
java.util.Optionalis that there's no unsafeget()method that can be called.getOrThrow()exists to make it clear that an exception will be thrown if there's no value. Users can also use pattern matching instanceof or switch expressions on the ADT types, which j.u.Optional does not provide.Closes #7447