About 37,100 results
Open links in new tab
  1. Optional (Java Platform SE 8 ) - Oracle

    Returns a non-empty string representation of this Optional suitable for debugging. The exact presentation format is unspecified and …

  2. Guide To Java Optional - Baeldung

    Feb 15, 2026 · In this tutorial, we’re going to show the Optional class that was introduced in Java 8. The purpose of the class is to …

  3. Optional (Java SE 21 & JDK 21) - Oracle

    Optional is primarily intended for use as a method return type where there is a clear need to represent "no result," and where using …

  4. Java 8 Optional Class - GeeksforGeeks

    Oct 1, 2026 · Java 8 introduced the Optional class to represent a value that may or may not be present. It provides a clear way to …

  5. Java Optional - W3Schools

    Learn how to use Optional in Java to handle values that might be missing, and avoid NullPointerException errors.

  6. Using Optionals - Dev.java

    If you design a method that returns an optional, or need to store an optional in a variable, then you should not return null or set this …

  7. Java 8 Optional 类 - 菜鸟教程

    Java 8 Optional 类 Java 8 新特性 Optional 类是一个可以为null的容器对象。 如果值存在则isPresent ()方法会返回true,调用get ()方 …

  8. Java Optional Guide: Methods, Examples and Best Practices

    Oct 10, 2026 · Java 9 added two methods that connect an Optional to other lookups and to streams. The or () method returns …

  9. Optional or() method in Java with examples - GeeksforGeeks

    Sep 18, 2026 · The or () method checks the current Optional and uses the supplied Supplier only when no value is present. Check …

  10. Java - Optional Class - Online Tutorials Library

    It is introduced in Java 8 and is similar to what Optional is in Guava. Optional class provides a type check solution instead of directly …