top | item 28585980 (no title) rnentjes | 4 years ago Alternative way to count the vowels in Kotlin: val numVowels = countVowels(getDTO()?.string ?: "") discuss order hn newest ptx|4 years ago Or alternatively, closer to the original, doing both null checks the same way the original does the first one: val numVowels = getDTO()?.string?.let(::countVowels) ?: 0
ptx|4 years ago Or alternatively, closer to the original, doing both null checks the same way the original does the first one: val numVowels = getDTO()?.string?.let(::countVowels) ?: 0
ptx|4 years ago