Is there a better way to write that? ``` val va...
# getting-started
f
Is there a better way to write that?
Copy code
val validConditions = mutableListOf<Condition>()
        validConditions.addAll(
                node.nextLinks.map { it as ConditionalLink }
                        .filter { it.condition.condition.isNotEmpty() && checker.check(it.condition, event.body()) }
                        .onEach { eventBus.send(it.eventName, event) }
                        .map { it.condition }                        

        )
        if (validConditions.isEmpty()) {
            validConditions.addAll(node.nextLinks
                    .map { it as ConditionalLink }.filter { it.condition == Condition.ELSE }
                    .onEach {eventBus.send(it.eventName, event) }
                    .map { it.condition })

        }
Thanks all