https://kotlinlang.org logo
#getting-started
Title
# getting-started
c

Casey Brooks

10/10/2023, 6:16 PM
Is there a version of
Sequence.zipWithNext
that emits on the very first item (with one item in the pair being null), rather than waiting for the first 2 emissions to be sent?
k

Klitos Kyriacou

10/10/2023, 6:27 PM
You can write it yourself:
Copy code
fun Sequence<T>.foo() = (sequenceOf(null) + this).zipWithNext()
🙌 1
2 Views