[ 
https://issues.apache.org/jira/browse/GROOVY-10891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653371#comment-17653371
 ] 

ASF GitHub Bot commented on GROOVY-10891:
-----------------------------------------

paulk-asert commented on PR #1839:
URL: https://github.com/apache/groovy/pull/1839#issuecomment-1368316519

   It is filling a hole in existing functionality. Take `find` and `findAll` 
for instance, they have the no Closure variants:
   ```
   var list = [null, '', 'A', null, 'B']
   assert list.findAll() == ['A', 'B']
   assert list.find() == 'A'
   ```
   These return all (or the first) element that satisfies Groovy truth. It is 
common in Groovy to provide these shortcuts even though `findAll { it }` and 
`find { it }` would do in the above examples. The same applies for `groupBy`, 
`collect`, `collectEntries`, and others. We have never gotten around to 
providing the findResult/s variants which is what this PR does. It improves 
Groovy's consistency in the API.
   




> 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)

Reply via email to