arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / takeLastOrNull

takeLastOrNull

fun takeLastOrNull(n: Int): Stream<O?>

Emits the last n elements of the input.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream.empty<Int>()
    .takeLastOrNull(5)
    .toList()
    .let(::println) // [null]
//sampleEnd

Do you like Arrow?

Arrow Org
<