約9,300件1ページ目

日本語のみで絞り込む

条件を指定して検索しています。すべての条件を解除する

  • 最終更新日:3か月以内
  • 2026/9/24 -If the value is null, it returns an empty Optional instead. It is useful when a value might be null and needs to be represented using Optional. Unlike Optional.

    11時間前 -Java Optional ofNullable() Method: returns an Optional with the value, or an empty Optional if the value is null. Syntax, parameters and an example.

    2026/8/22 -Optional.ofNullable is used when the argument may be null . It creates an empty Optional for a null argument. Simple example.

    4日前 -It can return null, or it can return a special empty value. Null is the default in the Java, and it is unchecked. Nothing in the type system warns you that ...

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

    5日前 -However, this time it also sets the optional field to an empty string if it's included but set to null. Let's use a test method to verify that the null value ...

    2日前 -The most common Optional anti-pattern is wrapping a potentially null value in an Optional , only to immediately invoke .get() without checking if a value is ...

    2026/10/10 -The orElse() method accepts null as the default, and orElseGet() returns whatever the supplier returns, including null. A null supplier is different, because ...

    2026/8/20 -When you see a method returning Optional , it serves as a reminder that the method might return an empty value and we need to be prepared for it. The ...

    2026/9/16 -A method that returns Optional must never return null . An empty result already has a representation: Optional.empty() . Returning null instead of an empty ...