I created https://issues.apache.org/jira/browse/GROOVY-10879 to track this
issue. It points to the current proposed PR.
Currently I am proposing a few additional overloads and a few additional
specific methods. I think this gives a good balance between improved typing
information and succinct
+1.
Hi all. For me it makes more sense to have a specific method for that
(collectEntriesWith, collectEntriesWithKey...) than overloading
collectEntries and forcing me to introduce the java.util.function api just
for so little.
El lun, 19 dic 2022 a las 12:23, Paul King () escribió:
>
> Hi
True, no direct equivalents for associateBy and associateWithValue. But
"collectEntries{ [it.toLowerCase(), it] }" is pretty succinct.
If you wanted to extend with just one new extension of collectEntries, I think
".collectEntries(keyFun, Function.identity())" and
+1
Cheers,
Daniel Sun
On 2022/12/19 11:23:19 Paul King wrote:
> Hi folks,
>
> @mrhaki who many of you may know as the author of "Groovy Goodness" also
> covers other topics and recently covered Kotlin's associate method:
>
>
Hi folks,
@mrhaki who many of you may know as the author of "Groovy Goodness" also
covers other topics and recently covered Kotlin's associate method:
https://blog.jdriven.com/2022/12/kotlin-kandy-transform-items-in-a-collection-to-a-map-with-associate/
Groovy addresses this use case fairly