https://kotlinlang.org logo
Title
v

vinny2020

04/09/2020, 6:40 PM
Hello All, old javahead here, is there a more elegant way in deal with the classic issue of having to double iterate data struictures like : List<MyPojo> when MyPojo also has collection as a property (ex var myProp: List<String> ) ?
c

Casey Brooks

04/09/2020, 6:48 PM
So you’re looking to just have a single loop over all the pojo’s strings?
pojoList.flatMap { it.myProp }
will get that for you
👍🏽 3
v

vinny2020

04/09/2020, 6:56 PM
hmm, let me experiment with that. I didn’t realize it could work with objects as well
One thing I have been liking about Kotlin is that it’s definitely broadening my realm of known unknowns 🙂
Thanks!