約107件1ページ目

日本語のみで絞り込む

2018/8/27 -Using Optional as a return value avoids the problem of the caller accidentally misusing the sentinel value as the real return value. Given this, ...

2021/6/15 -A variable whose type is Optional should never itself be null; it should always point to an Optional instance.” The primary intended use ...

2025/5/17 -Optional<T> is a container object which may or may not contain a non-null value. ✓ Why Use Optional ? Avoid null checks; Improve readability ...

2026/4/13 -Using Optional.of() on a potentially null value. Optional.of(nullValue) throws NPE immediately — the opposite of what you want. Always use ...

2018/1/18 -There is next to no added value in having an Optional of a single value. As you've seen, that just replaces a check for null with a check for ...

2024/9/7 -ofNullable(T value): Creates an Optional that may hold a null value. isPresent(): Checks if there is a non-null value inside the Optional.

2026/6/30 -Reports uses of Optional.ofNullable() where always null or always not-null argument is passed. There's no point in using Optional.ofNullable() ...

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 ...

2020/11/3 -By using Optional, we are avoiding null checks and can specify alternate values to return, thus making our code more readable.” But then the ...

2017/1/28 -Lately I see a lot of code like. Optional.ofNullable(i).ifPresent(x->doBla(x));. instead of a old known: if (i != null) { doBla(i); }.