I have the following code:
boolean allApproved = traverse(root)
.map(element -> element.getAttribute(LisecConstants.ATTRIBUTE_APPROVED))
.filter(Objects::nonNull)
.map(Boolean::parseBoolean)
.allMatch(x -> x);
where some elements get traversed, then mapped for an "approved" attribute and in the end I want to know if all elements are approved.
Sometimes I stumble upon the case where I use a lambda expression like "x -> x" like here. Although this expression is probably shorter than any short form, is there an expression used with the double colon operator? I think this makes the code more readable and more consistent with the rest of the code.
I am aware that I simply could rewrite the code a bit different and probably dodge this case here, but let's keep it simple:
Is there an alternative expression for x -> x
?