Open iirekm opened 5 years ago
Here we can split into two things:
Fold Optional
to null safe operators. For example on my working project it's very popular to use Optional as Elvis operator:
BigDecimal totalAmount = Optional .ofNullable(amount).orElse(BigDecimal.ZERO);
Replace Stream.map()
with spread operator.
But here is not so straightforward: there is other map*
functions, it will look not consistent to others.
@iirekm @stokito I have incorporated the Optional feature, and I plan to implement the spread operator in upcoming implementations. For further details, please refer to my branch.
https://github.com/AntoniRokitnicki/AdvancedExpressionFolding/pull/10
Java 8 code contains a lot of stuff like
it would be nice to have on the screen just:
Similarly for streams:
can be: