any(), none() & all() : Kotlin

This post was originally posted at https://agrawalsuneet.github.io/blogs/any-none-all-kotlin/ and reposted on Medium on 28th April 2021.

Any

val list = listOf("one", "two", "three", "four")
val set = setOf("one", "two", "three", "four")
val map = mapOf(1 to "one", 2 to "two", 3 to "three", 4 to "four")

println(list.any { it.endsWith("e") }) // true
println(set.any { it.endsWith("e") }) // true
println(map.any { it.value.endsWith("e") }) // true

Please continue reading at https://agrawalsuneet.github.io/blogs/any-none-all-kotlin/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store