There is no elegant solution here, but you can do filtering inside the display:
.map(a -> { B b = load(a); return filter(a, b) ? b : null; }) .filter(Objects::nonNull)
You do not need to create wrappers around flow elements. The load method will only execute once if it is an expensive operation.
null is an invalid default value, it should be replaced if null enabled or it can be returned from load .
Andrew
source share