Re:Overhead of Returning Optional Values in Java and Rust
by heurisko on Saturday October 16, 2021 @03:10PM
(#28890526)
Java Optionals are useful in Streams.
I've found I agree with the principle that Optionals only make sense for return values (and if the method returns null, that should be treated as a bug).
I've seen Optionals used for member variables, and they might as well just be null. (And are highlighted as such by IDEs like IntelliJ).
I've found I agree with the principle that Optionals only make sense for return values (and if the method returns null, that should be treated as a bug).
I've seen Optionals used for member variables, and they might as well just be null. (And are highlighted as such by IDEs like IntelliJ).