4 ms·
Also in Kotlin you can have extension methods with multiple receivers: class Dictionary { val wordList = setOf<String>() fun String.isWord(w
by cel1ne 10y ago
Also in Kotlin you can have extension methods with multiple receivers:
class Dictionary {
val wordList = setOf<String>()
fun String.isWord(word): Boolean =
word in wordList
}
...
val myDictionary = Dictionary()
with (Dictionary) {
println("dog".isWord)
}
(you can skip the "with" when being inside Dictionary)