Java 8 | DoubleSupplier Interface with Examples Last Updated : 10 Oct, 2018 Comments Improve Suggest changes Like Article Like Report The DoubleSupplier Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which does not take in any argument but produces a double value. The lambda expression assigned to an object of DoubleSupplier type is used to define its getAsDouble() which eventually applies the given operation on its argument. It is similar to using an object of type Supplier<Double> Functions in DoubleSupplier Interface The DoubleSupplier interface consists of the only one function: 1. getAsDouble() This method does not take in any value but produces a double-valued result. Syntax: double getAsDouble() Return Value: This method returns a double value. Below is the code to illustrate getAsDouble() method: Program: Java // Java Program to illustrate // getAsDouble method of // DoubleSupplier Interface import java.util.function.DoubleSupplier; public class GFG { public static void main(String args[]) { // Create a DoubleSupplier instance DoubleSupplier sup = () -> Math.random(); // Get the double value // Using getAsDouble() method System.out.println(sup.getAsDouble()); } } Output: 0.10283070415816953 Comment More infoAdvertise with us Next Article Java 8 | DoubleSupplier Interface with Examples P psil123 Follow Improve Article Tags : Misc Java Java - util package java-basics Java 8 +1 More Practice Tags : JavaMisc Similar Reads Java 8 | BooleanSupplier Interface with Examples The BooleanSupplier Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which does not take in any argument but produces a boolean value. The lambda expression assigned to an object of Boo 1 min read DoubleFunction Interface in Java with Examples The DoubleFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in a double-valued argument and produces a result of type R. This functional interface takes in only one 1 min read Java 8 | DoubleToIntFunction Interface in Java with Example The DoubleToIntFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in a double-valued argument and gives an int-valued result. The lambda expression assigned to an obj 1 min read Java 8 | DoubleToLongFunction Interface in Java with Examples The DoubleToLongFunction Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which takes in a double-valued argument and gives an long-valued result. The lambda expression assigned to an o 1 min read DoubleStream builder() in Java with Examples DoubleStream builder() returns a builder for a DoubleStream. Syntax : static DoubleStream.Builder builder() Parameters : DoubleStream.Builder : A mutable builder for a DoubleStream. A stream builder has a lifecycle, which starts in a building phase, during which elements can be added, and then trans 1 min read Java.util.function.DoubleBinaryOperator interface with Examples The DoubleBinaryOperator interface was introduced in Java 8. It represents an operation on two double values and returns the result as a double value. It is a functional interface and thus can be used as a lambda expression or in a method reference. It is mostly used when the operation needs to be e 2 min read DoubleAdder add() method in Java with Examples The java.DoubleAdder.add() is an inbuilt method in java that adds the given value to the previous or initial value. When the object of the class is created its initial value is zero. Syntax: public void add(double x) Parameters: This method accepts a single parameter x that specifies the value to be 1 min read Double intValue() method in Java with examples The intValue() method of Double class is a built in method to return the value specified by the calling object as int after type casting. Syntax: DoubleObject.intValue() Return Value: It return the value of DoubleObject as int. Below programs illustrate intValue() method in Java: Program 1: Java // 2 min read DoubleAdder intValue() method in Java with Examples The java.DoubleAdder.intValue() is an inbuilt method in java that returns the sum() as an int after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public int intValue() Parameters: This method does not accepts any parameter. Return Value: 1 min read Byte doubleValue() method in Java with examples The doubleValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as double. Syntax ByteObject.doubleValue() Return type: It returns the value of ByteObject as double. Below is the implementation of doubleValue() method in Java: Example 1: Java 2 min read Like