public static Function<Integer, Integer> turnUp = i -> i++;
However, the solution from my program did not match the official answer. At first glance, I could not figure out the cause for the discrepancy. But after thinking about it for a while, I had a “a-ha moment” and wondered if the postfix version of the increment operation was the source of my issue. So I modified the functions to a prefix version as follows.
public static Function<Integer, Integer> turnUp = i -> ++i;
Sure enough, the solution from my program matched the answer after this change.
The lesson here is that if you are relying on an implicit return from your lambda function, then you should use the prefix version of unary operations. That will ensure that the operation is performed before rather than after the return action.