kbox-android / ch.tutteli.kbox / kotlin.sequences.Sequence

Extensions for kotlin.sequences.Sequence

appendToStringBuilder

fun <T> Sequence<T>.appendToStringBuilder(sb: StringBuilder, separator: String, append: (it: T) -> Unit): Unit

Appends all elements of this Sequence to the given sb by calling append and separates the elements with the given separator.

joinToString

fun <T> Sequence<T>.joinToString(separator: String, append: (it: T, StringBuilder) -> Unit): String

Joins all elements of this Sequence by calling append and separates the elements with the given separator.

mapWithIndex

fun <T> Sequence<T>.mapWithIndex(): Sequence<WithIndex<T>>

Maps the values to WithIndex, containing the index next to the value itself.