Does anyone have a good resource for learning coll...
# announcements
s
Does anyone have a good resource for learning collections in Kotlin? That is the one place I seem to really be struggling
w
Did you go through the collections section of Kotlin Koans? https://play.kotlinlang.org/koans/Collections/Introduction/Task.kt
j
fun Shop.getSetOfCustomers(): Set<Customer> = TODO()
is just plain bad kotlin.
h
do you mean because it's better to write as:
Copy code
val Shop.customers get() = setOf(...)
?
If so, keep in mind this is tutorial. They're trying to help people learn the language fundamentals, and the official kotlin style of doing it would add an extra layer of confusion
styling code is bottom of priority when learning a language
☝️ 1
also the name implies the answer is
setOf(customers)
, which is incorrect. A python user might assume that is the way, and they need to learn how casting is done in Kotlin