約123件1ページ目

日本語のみで絞り込む

2020/2/8 -if(someOptional.isPresent()){ return somevalue; } else{ return null; }. In the above case, Optional does not bring you more than using null only ...

2017/6/14 -If null handling is very important, use an Optional. If null is a valid return that does not indicate unavailability or failure, use an Optional ...

2026/2/26 -It provides a clear and explicit way to convey the message that there may not be a value, without using null. When getting an Optional return ...

2016/2/3 -Optional is used with the convention that methods with return type Optional never return null ... function isNotNull( object o ) { return ( null ...

A container object which may or may not contain a non-null value. If a value is present, isPresent() will return true and get() will return the value.

2023/2/1 -Optional is a container object that may or may not contain a non-null value and provides a range of practical methods for working with its ...

The Null Object pattern is The Correct Answer (for Java like languages). Java's Optional is a bad idea implemented badly made even more bad by bad usage.

2025/3/20 -✓ Prevents NullPointerException — Instead of returning null , Optional<> ensures the absence of a value is handled gracefully. ✓ Improves Code ...

You can create an optional object from a nullable value using the static factoy method Optional.ofNullable . The advantage over using this method is if the ...

2026/10/1 -ofNullable(value): Creates an Optional containing the value if it is non-null; otherwise, returns an empty Optional. Example 1: Using empty() ...