kirillrakhman
02/09/2016, 4:30 PMoverride fun onNext(results: List<ConnectionResult>) {
val (resultsInbound, resultsOutbound) = results.partition { it.isReturn }
val buf = buffer
if (buf != null) {
if (selectedOutbound in resultsOutbound) {
if (buf.isNotEmpty()) {
super.onNext(buf)
}
buffer = null
} else {
buf.addAll(resultsInbound)
}
} else if (resultsInbound.isNotEmpty()) {
super.onNext(resultsInbound)
}
}
here's my code now. this will never crash and as far as I can see it's doing the correct thing. so win?