```// 1 fun matchUtterance(match: MatchResult): Li...
# codereview
e
Copy code
// 1
fun matchUtterance(match: MatchResult): List<MatchResult> =
    alternatives.flatMap { pattern ->
        pattern.matchUtterance(match)
    } + if (empty) listOf<MatchResult>(match) else emptyList<MatchResult>()
or
Copy code
// 2
fun matchUtterance(match: MatchResult): List<MatchResult> {
    val results = alternatives.flatMap { pattern ->
        pattern.matchUtterance(match)
    }
    return if (empty) results + listOf(match) else results
}
2️⃣ 7