You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2023/01/01 01:29:31 UTC

[GitHub] [groovy] paulk-asert commented on pull request #1839: GROOVY-10891: We should have variants of findResult/s with no Closure…

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.
   


-- 
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: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org