OptionalDouble empty() method in Java with examples Last Updated : 01 May, 2019 Comments Improve Suggest changes Like Article Like Report OptionalDouble help us to create an object which may or may not contain a Double value. The empty() method returns an empty OptionalDouble instance. No value is present for this OptionalDouble. So we can say that this method help us to create empty OptionalDouble object. Syntax: public static OptionalDouble empty() Parameters: This method accepts nothing. Return value: This method returns an empty OptionalDouble. Below programs illustrate empty() method: Program 1: Java // Java program to demonstrate // OptionalDouble.empty() method import java.util.OptionalDouble; public class GFG { public static void main(String[] args) { // create a OptionalDouble // using empty method OptionalDouble opDouble = OptionalDouble.empty(); // Print the created instance System.out.println("OptionalDouble: " + opDouble.toString()); } } Output: OptionalDouble: OptionalDouble.empty References: https://docs.oracle.com/javase/10/docs/api/java/util/OptionalDouble.html#empty() Comment More infoAdvertise with us Next Article OptionalDouble empty() method in Java with examples A AmanSingh2210 Follow Improve Article Tags : Java Java - util package Java-Functions Java-OptionalDouble Practice Tags : Java Similar Reads Optional empty() method in Java with examples The empty() method of java.util.Optional class in Java is used to get an empty instance of this Optional class. This instance do not contain any value. Syntax: public static <T> Optional<T> empty() Parameters: This method accepts nothing. Return value: This method returns an empty instan 1 min read OptionalLong empty() method in Java with examples OptionalLong help us to create an object which may or may not contain a Long value. The empty() method returns an empty OptionalLong instance. No value is present for this OptionalLong. So we can say that this method help us to create empty OptionalLong object. Syntax: public static OptionalLong emp 1 min read OptionalInt empty() method in Java with examples OptionalInt help us to create an object which may or may not contain a int value. The empty() method returns an empty OptionalInt instance. No value is present for this OptionalInt. So we can say that this method help us to create empty OptionalInt object. Syntax: public static OptionalInt empty() P 1 min read OptionalDouble stream() method in Java with examples The stream() method help us to get double value contain by OptionalDouble as DoubleStream.If a value is present, method returns a sequential DoubleStream containing only that value, otherwise returns an empty DoubleStream. Syntax: public DoubleStream stream() Parameters: This method accepts nothing. 1 min read Optional orElse() method in Java with examples The orElse() method of java.util.Optional class in Java is used to get the value of this Optional instance, if present. If there is no value present in this Optional instance, then this method returns the specified value. Syntax: public T orElse(T value) Parameters: This method accepts value as a pa 2 min read Like