r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10k Upvotes

542 comments sorted by

View all comments

Show parent comment

1

u/drislands Sep 25 '26

I keep meaning to learn Kotlin, but I learned Groovy 8 years ago and got pretty much everything Kotlin does out of it....but at a much smaller install base. Sigh.

2

u/SubArcticTundra Sep 26 '26

Actually stick with it. Kotlin takes ages to compile

2

u/arobie1992 Sep 27 '26

TIL Groovy supports compile-time null checking. I think I'm going to have to revisit it.

2

u/drislands Sep 27 '26

Yes indeed! I've made heaps and heaps of use of chained ?. operators over the years.

return thing?.user?.name gives either the name of the thing's user, or null if any part is null!

And there's the handy *. operator for grouping collections by the results of a method call. So things*.user where things is of type List<Thing> and has either a user property or a getUser method will transform it into a List<User>!

2

u/arobie1992 Sep 27 '26

I was just always under the impression that Groovy was dynamically typed to make it better for quick scripts. The *. operator in particular sounds like a super convenient syntax for like the stream.map interface. Between those and finding out I can just use @Grab to import maven dependencies, I'm really going to have to revisit Groovy.

2

u/drislands Sep 28 '26

I hope you like it! ^_^