This Week I Learned: Kotlin collections operations [2022–05–27]

Peter Brownlow
May 27, 2022

--

Photo by Karen Vardazaryan on Unsplash

Kotlin has a lot of in-built operations on collections. You can do many powerful things very easily without relying on any libraries. I’m enjoying having the collections manipulation facilities that I’m used to from Node & Java plus some new ones.

Here is a screenshot of some code that I wrote as part of Kotlin Koans, which is also pretty neat. The live and commented-out code blocks produce the same result. One is half the size of the other and just needed a little extra thought to produce.

both are readable but my 2nd attempt is shorter and clearer

Go explore the collection operations — there’s a lot of neat stuff in there.

--

--

Peter Brownlow
Peter Brownlow

Written by Peter Brownlow

Software builder, people manager, topical deep-dive enthusiast

Responses (1)