DEV Community

loading...

Discussion on: From Java to Kotlin in 20 minutes ⚡️

Collapse
abhinav1217 profile image
Abhinav Kulshreshtha

Ok, So isEmpty check is replaced by having an initial value as parameter of fold. case for 1 or more is handled by lambda. I think I understand it now. So those check-steps are not needed anymore.

acc will be initialized as empty setOf string because that is what is passed inside fold(), c will be current iterated value. and then you call combineSolutions with acc and mapPin of c.

Man lambdas are trippy.

Thread Thread
jmfayard profile image
Jean-Michel Fayard 🇫🇷🇩🇪🇬🇧🇪🇸🇨🇴 Author

Exactly 👏🏻