Consider a mutable list with boolean values,
MutableList{true, false, false}
How to return the boolean value after performing a logical AND on all of the values within the list using Kotlin fold?
Assuming the list is not empty, if any item of the list is false
then the result is false
:
val result = !list.any { !it }