eric-milles commented on PR #1732:
URL: https://github.com/apache/groovy/pull/1732#issuecomment-1165715088
You can also do this, but I don't think it is an improvement over
"optional.map(String::length).orElse(null)" or
"optional.orElse(null)?.length()":
```groovy
def nothing = Optional.empty(), something = Optional.of('foo')
def value = nothing*.length()?[0]
assert value == null
value = something*.length()?[0]
assert value == 3
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]