Question: 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() }
}

```

Answer: 
Put the [`all`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/all.html) in an `if`-condition, e.g.:

```
fun startProcess() {
  if (completed.all { it })
    callback.onFinished()
}

```

from the linked `all`-reference:

> 
> Returns `true` if all elements match the given predicate.
> 
> 
>
Just use:

```
private var completed: BooleanArray = booleanArrayOf(false, false, false, false)
if (completed.all { it }) {
    callback.onFinished()
}

```