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

dropWhile

fun dropWhile(p: (O) -> Boolean): Stream<O>

Drops elements from the head of this stream until the supplied predicate returns false.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream.range(0..10)
    .dropWhile { it != 4 }
    .toList()
    .let(::println) // [4, 5, 6, 7, 8, 9, 10]
//sampleEnd

Do you like Arrow?

Arrow Org
<