約108件1ページ目

日本語のみで絞り込む

2022/4/12 -If the given object is nullable by its nature, i.e. null isn't an abnormal case, then use Optional.ofNullable() , it'll fire either a box ...

2026/9/24 -The ofNullable() method handles both non-null and null values by creating an Optional containing the value or returning an empty Optional, ...

2024/8/7 -ofNullable() method is used to create an Optional object that may or may not contain a value. It takes a single argument, which can be null, and ...

static <T> Optional<T>, ofNullable(T value). Returns an Optional describing the specified value, if non-null, otherwise returns an empty Optional . T · orElse(T ...

2025/4/7 -Optional.of() is the 'constructor' to make the SOME variant. Given that it is not possible to construct the SOME variant with a null value, ...

2026/2/15 -Optional makes us deal with nullable values explicitly as a way of enforcing good programming practices. Let's now look at how the above code ...

2023/2/1 -Optional is a Java class that provides a way to handle null values in a type-safe and efficient manner. This tutorial will cover the ...

2026/4/13 -Optional is not a null eliminator — it is an API contract: a method that returns Optional<T> is telling callers explicitly that no value may ...

2026/4/16 -Optional.of(userId) : 値が必ず入っている前提で Optional を作る · Optional.ofNullable(nickname) : 値が null かもしれない前提で Optional を作る.

It is used in methods that wish to optionally return a value, in preference to returning null . In fact, the class here is a reimplementation of the essential ...