IntUnaryOperator compose returns a composed operator that first applies the before operator to its input, and then applies this operator to the result.
compose
has the following syntax.
default IntUnaryOperator compose(IntUnaryOperator before)
The following example shows how to use compose
.
import java.util.function.IntUnaryOperator; public class Main { public static void main(String[] args) { IntUnaryOperator i = (x) -> x*x; System.out.println(i.compose(i).applyAsInt(2)); } }
The code above generates the following result.