DoubleSupplier
represents a supplier of double-valued results.
This is the double-producing primitive specialization of Supplier
.
The following example shows how to use DoubleSupplier
.
import java.util.function.DoubleSupplier; /* www . j a v a 2 s. c o m*/ public class Main { public static void main(String[] args) { DoubleSupplier pi = () -> {return 3.14d;}; System.out.println(pi.getAsDouble()); } }
The code above generates the following result.