Example usage for java.util.function DoubleUnaryOperator compose

List of usage examples for java.util.function DoubleUnaryOperator compose

Introduction

In this page you can find the example usage for java.util.function DoubleUnaryOperator compose.

Prototype

default DoubleUnaryOperator compose(DoubleUnaryOperator before) 

Source Link

Document

Returns a composed operator that first applies the before operator to its input, and then applies this operator to the result.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleUnaryOperator square = (x) -> {
        return x * x;
    };/*ww  w  .  j a v  a 2  s  . co m*/

    DoubleUnaryOperator doubleValue = (x) -> {
        return 2 * x;
    };

    System.out.println(doubleValue.compose(square).applyAsDouble(3.14));
}