Composing operators

Report a typo

You have the following part of code:

IntUnaryOperator mult2 = num -> num * 2;
IntUnaryOperator add3 = num -> num + 3;

IntUnaryOperator combinedOperator = add3.compose(mult2.andThen(add3)).andThen(mult2);
int result = combinedOperator.applyAsInt(5);

The result is ...

Enter a short text
___

Create a free account to access the full topic