Reputation: 2650
When all booleans are set to true and I run startProcess() then it should be true and I want to execute the onFinished() method. How do I do this?
private var completed: BooleanArray = booleanArrayOf(false, false, false, false)
fun startProcess() {
completed.all { it -> callback.onFinished() }
}
Upvotes: 1
Views: 2890
Reputation: 7368
Just use:
private var completed: BooleanArray = booleanArrayOf(false, false, false, false)
if (completed.all { it }) {
callback.onFinished()
}
Upvotes: 1