約123件1ページ目

日本語のみで絞り込む

2016/11/24 -By explicitly returning an Optional, the caller of someFunc() is made aware that the interface could potentially return null. From an interface ...

2023/7/24 -We can create an Optional instance using the of() method if we are sure the value is non-null. If the value passed to of() is null, it will ...

2016/2/3 -Optional is used with the convention that methods with return type Optional never return null and usually also with the (less strong) convention ...

2023/2/1 -By wrapping a potentially null value in an Optional, you can safely access the value without risking a NullPointerException. For example, if you ...

2024/6/12 -The whole purpose of Optional is to represent method return values that may be null. Drives me nuts to see it used as a glorified null check.

2021/5/27 -Optionals are often used unnecessarily as tools to perform local null checks instead of using regular if-else statements.

2026/2/15 -This code checks if the name variable is null or not before going ahead to execute some code on it. This approach is lengthy, and that's not the ...

2025/12/10 -I'm currently refactoring a Java application to improve its handling of null values. I've come across the Optional class and would like to ...

2015/10/13 -By the way, instead of Optional.ofNullable(null) you could just write Optional.empty().

2022/2/6 -A look at how Optional works, and how it isn't really about Null values - at least not if you were doing it right before Optional.