Kotlin any none all
Tue, Apr 19, 2016In this artile describes the colletion function of the stream api of Kotlin.
any
- Or also applies to conditions in one
>>> listOf(1,2,3,4,5).any { it > 4 }
true
>>> listOf(1,2,3,4,5).any { it > 5 }
false
none
- It dose not apply to the conditions
>>> listOf(1,2,3,4,5).none { it > 6 }
true
>>> listOf(1,2,3,4,5).none { it > 4 }
false
all
- It applies to all conditions
>>> listOf(1,2,3,4,5).all { it > 0 }
true
>>> listOf(1,2,3,4,5).all { it > 4 }
false