Java Lambda - DoubleFunction example

DoubleFunction represents a function that accepts a double-valued argument and produces a result. This is the double-consuming primitive specialization for Function.


  1. DoubleFunction apply


The following example shows how to use DoubleFunction.

import java.util.function.DoubleFunction;
// w w w.  j  av a 2 s . c o m
public class Main {

  public static void main(String[] args) {
    DoubleFunction<String> df = (d) -> d +" is now a string";



The code above generates the following result.