Dalinar
06/25/2017, 8:46 PManyMatch
was a typo, I meant all { }
and allMatch { }
@kevinmost @arocniesDalinar
06/25/2017, 8:48 PMfun main(args: Array<String>) {
val x = emptyMap<String,String>()
println(x.values.all { false })
println(x.values.all { true })
println(x.values.all { it.equals("nothing") })
println(x.values.stream().allMatch( { false }))
println(x.values.stream().allMatch( { true }))
}
true
true
true
true
true
Process finished with exit code 0
Dalinar
06/25/2017, 8:51 PM0
elements that I could use. Is there? or do I need to roll my own extension fun
?kevinmost
06/25/2017, 8:54 PMval allMatch = list.takeIf { it.isNotEmpty }?.all { cond } ?: false
val allMatch = list.isNotEmpty && list.all { cond }