[
https://issues.apache.org/jira/browse/GROOVY-10891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653441#comment-17653441
]
ASF GitHub Bot commented on GROOVY-10891:
-----------------------------------------
eric-milles commented on PR #1839:
URL: https://github.com/apache/groovy/pull/1839#issuecomment-1368491569
Okay, just picked up on the difference. `find` and `findAll` apply groovy
truth and `findResult` and `findResults` check `null` only. Is that too subtle
a difference?
If this is what I am looking for:
```groovy
def list = [null, '', 'A', null, 'B', false]
assert list.find() == 'A'
assert list.findAll() == ['A', 'B']
assert list.xxx == ''
assert list.yyy == ['','A', 'B',false]
```
For myself, I'd look to sub "xxx" with `find{it != null}` or
`find(Objects::nonNull)` and "yyy" with `findAll{it != null}` or
`findAll(Objects::nonNull)`. Nice and clear IMO.
I'm just really stuck on "result" in `findResult` meaning something other
than the input value.
> We should have variants of findResult/s with no Closure which use
> Closure.IDENTITY in that case
> -----------------------------------------------------------------------------------------------
>
> Key: GROOVY-10891
> URL: https://issues.apache.org/jira/browse/GROOVY-10891
> Project: Groovy
> Issue Type: Improvement
> Reporter: Paul King
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)