🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › Optional.html
Optional (Java SE 17 & JDK 17)
April 21, 2026 - Optional is primarily intended for use as a method return type where there is a clear need to represent "no result," and where using null is likely to cause errors.
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › class-use › Optional.html
Uses of Class java.util.Optional (Java SE 17 & JDK 17)
April 21, 2026 - Classes to support low-level and efficient foreign memory/function access, directly from Java. ... Returns an array of Strings of the arguments of the process. ... Returns the build number. ... Returns the executable pathname of the process. ... Returns the command line of the process.
🌐
Reddit
reddit.com › r/java › named and optional parameters in java 17 - redefined version
r/java on Reddit: Named and Optional Parameters in Java 17 - Redefined Version
January 15, 2023 - It took me some time to make it work well, but in short here the issues that the compiler found previously related to the illegal syntax of named parameters and default values inside \@Option are marked as resolved in the Diagnostics. If for example the wrong types, unknown named parameters, ... are used to call a method or a class they are still reported by Javac normally.
🌐
Baeldung
baeldung.com › home › java › core java › guide to java optional
Guide To Java Optional | Baeldung
February 15, 2026 - Java has a very fluent and elegant ... programming concepts. The newest Java version introduces the stream() method on the Optional class that allows us to treat the Optional instance as a Stream....
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › OptionalLong.html
OptionalLong (Java SE 17 & JDK 17)
January 20, 2026 - OptionalLong is primarily intended for use as a method return type where there is a clear need to represent "no result." A variable whose type is OptionalLong should never itself be null; it should always point to an OptionalLong instance.
🌐
GitHub
github.com › Auties00 › NamedParameters
GitHub - Auties00/NamedParameters: Named and Optional parameters for Java 17 · GitHub
// Constant void sayHello(String name, @Option(18) int age){ System.out.printf("Hello, %s(age: %s)%n", name, age); } // Dynamic values void sayHello(String name, @Option(getDefaultAge(name)) int age){ System.out.printf("Hello, %s(age: %s)%n", name, age); } int getDefaultAge(String name){ // Some incredible logic return 0; } sayHello(name="Alessandro");
Starred by 44 users
Forked by 4 users
Languages   Java
🌐
Tom Gregory
tomgregory.com › gradle › java-optional
Optional in Java: Everything You Need To Know | Tom Gregory
July 17, 2022 - At this point hopefully you've got a grasp of what Optional is all about. There are in total 17 methods you can call on the Optional class, and so far we've covered 6 of them: of, empty, ifPresent, ifPresentOrElse, orElse, and orElseThrow.
🌐
Medium
medium.com › @alberto-jimenez › java-class-optional-t-f05b99cd247c
Java Class Optional<T>. As of September 2021, Java 17 did not… | by Alberto Jimenez | Medium
October 23, 2023 - Java Class Optional As of September 2021, Java 17 did not include significant changes to the `Optional` class. The `Optional` class was introduced in Java 8 to address the problem of null values …
🌐
javaspring
javaspring.net › blog › java-17-optional
Java 17 Optional: A Comprehensive Guide — javaspring.net
The Optional class is a container object that may or may not contain a non-null value. It provides a way to represent the absence of a value in a more explicit and safer manner. This blog will explore the fundamental concepts, usage methods, ...
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › OptionalDouble.html
OptionalDouble (Java SE 17 & JDK 17)
April 21, 2026 - OptionalDouble is primarily intended for use as a method return type where there is a clear need to represent "no result." A variable whose type is OptionalDouble should never itself be null; it should always point to an OptionalDouble instance.
Find elsewhere
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › util › OptionalInt.html
OptionalInt (Java SE 17 & JDK 17) - Oracle Help Center
April 15, 2025 - OptionalInt is primarily intended for use as a method return type where there is a clear need to represent "no result." A variable whose type is OptionalInt should never itself be null; it should always point to an OptionalInt instance.
🌐
Stack Overflow
stackoverflow.com › questions › 77363146 › java-optional-after-map-operation-return-the-value-from-optional-object-only
Java Optional - After map operation, return the value from optional object only if IsPresent() is true - Stack Overflow
); } private Optional<String> getOptionalString(Map<String, string> map, String key){ //Some code goes here to get the value from a map. return Optional.ofNullable(....); } private Optional<String> findFullUrl(String val){ // some logic goes here to build a url return Optional.ofNullable(....); } java · java-17 ·
🌐
GitHub
github.com › openjdk › jdk17 › blob › master › src › java.base › share › classes › java › util › Optional.java
jdk17/src/java.base/share/classes/java/util/Optional.java at master · openjdk/jdk17
September 2, 2022 - * <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a> * class; programmers should treat instances that are · * {@linkplain #equals(Object) equal} as interchangeable and should not · * use instances for synchronization, or unpredictable behavior may · * occur. For example, in a future release, synchronization may fail. * * @apiNote · * {@code Optional} is primarily intended for use as a method return type where ·
Author   openjdk
🌐
Broadcom
techdocs.broadcom.com › us › en › ca-mainframe-software › security › ca-trusted-access-manager-for-z › 1-1 › administrating › -optional--configure-java-17-support.html
(Optional) Configure Java 17 Support - Broadcom TechDocs
April 25, 2025 - Change the JAVA_HOME from Java 8 to Java 17 by specifying the correct Java 17 path: export JAVA_HOME=/usr/lpp/java/ J8.0_64 · to · export JAVA_HOME=/usr/lpp/java/ J17.0_64 · Before the CLASSPATH add the following entries in the JVM options: IJO="$IJO -Dillegal-access=warn" IJO="$IJO -Dadd-opens=java.base/java.lang=ALL-UNNAMED" IJO="$IJO -Dadd-opens=java.base/java.io=ALL-UNNAMED" IJO="$IJO -Dadd-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" Change the LIBPATH from Java 8 to Java 17: LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390x LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390x/j9vm ·
🌐
DZone
dzone.com › coding › java › how to use optionals in java
How to Use Optionals in Java
June 16, 2020 - Java · x · 1 · public class Bar { 2 · 3 · private int number; 4 · 5 · public Bar(int number) { 6 · this.number = number; 7 · } 8 · 9 · // ...getters & setters... 10 · } 11 · 12 · Predicate<Bar> greaterThanZero = bar -> bar.getNumber() > 0; 13 · 14 · Optional.of(new Bar(1)) 15 · .filter(greaterThanZero) 16 · .isPresent(); // true · 17 ·
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › Optional.html
Optional (Java Platform SE 8 )
April 21, 2026 - If a value is present the result must include its string representation in the result. Empty and present Optionals must be unambiguously differentiable. ... Java™ Platform Standard Ed.
🌐
GitHub
github.com › openjdk › jdk › blob › master › src › java.base › share › classes › java › util › Optional.java
jdk/src/java.base/share/classes/java/util/Optional.java at master · openjdk/jdk
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a> * class; programmers should treat instances that are · * {@linkplain #equals(Object) equal} as interchangeable and should not · * use instances for synchronization, or unpredictable behavior may · * occur. For example, in a future release, synchronization may fail. * * @apiNote · * {@code Optional} is primarily intended for use as a method return type where ·
Author   openjdk
🌐
Infobip
infobip.com › home › pragmatic use of java records and optional
Java Records and Optional: A Pragmatic use | Infobip Developers Hub
September 11, 2023 - As Spring Boot 3 has raised the JDK requirement overnight to support at least Java 17, all code can now leverage newer language features. For bean classes, one newer language that comes into play in this context is Java Records. Some problems might appear when new mixes with the old, and one such example is mixing Records with good old (infamous) java.util.Optional.