I think this is a bit clearer: ``` override fun on...
# random
k
I think this is a bit clearer:
Copy code
override fun onNext(results: List<ConnectionResult>) {
    val (resultsInbound, resultsOutbound) = results.partition { it.isReturn }

    val buf = buffer

    if (buf != null) {
        buf.addAll(resultsInbound)
        if (selectedOutbound in resultsOutbound) {
            super.onNext(buf)
            buffer = null
        }
    } else if (resultsInbound.isNotEmpty()) {
        super.onNext(resultsInbound)
    }
}