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 well
+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:
>
> https://blog.jdriven.com/2022/12/kotlin-kandy-transform-items-in-a-col
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
".collectEntries(Function.ide