// "Replace nested function call with andThen call" "true-preview" import java.util.function.UnaryOperator; public class Main { private void testFn(boolean b) { String foo = "xyz"; Integer f = Integer.parseInt( (b ? (UnaryOperator) String::trim : (UnaryOperator) s -> s.substring(1)).apply(foo)); } }