thanks <@U0C2CG716> I tried a mix of both : ``` v...
# getting-started
f
thanks @dalexander I tried a mix of both :
Copy code
val validConditions = mutableListOf<ConditionalLink>()
        val conditionalNextLink = node.nextLinks.map { it as ConditionalLink }
        validConditions.addAll(
                conditionalNextLink
                        .filter { it.condition.condition.isNotEmpty() && checker.check(it.condition, message.body()) }
        )
        if (validConditions.isEmpty()) {
            validConditions.addAll(
                    conditionalNextLink
                            .filter { it.condition == Condition.ELSE }
            )

        }
        val validConditionsAsResponse = validConditions
                .onEach { eventBus.send(it.eventName, message) }
                .map { it.condition }
        
        message.reply(JsonObject().put("validConditions", validConditionsAsResponse))`
d
Maybe try
partition
and with prev. Answer takeIf ?: could save extra line or two...
f
👍