With a little of math you can do this: ``` fun joi...
# getting-started
o
With a little of math you can do this:
Copy code
fun joinList(collection: List<String>): String = StringBuilder().apply {
    append("{")
    collection.forEachIndexed { index, item -> append(", ", 0, index.coerceAtMost(1) * 2).append(item) }
    append("}")
}.toString()