kbox-android / ch.tutteli.kbox / kotlin.collections.Iterable

Extensions for kotlin.collections.Iterable

appendToStringBuilder

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

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

joinToString

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

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

mapWithIndex

fun <T> Iterable<T>.mapWithIndex(): List<WithIndex<T>>

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