Introduce array-like list instantiation functions.

#KT-14935 Fixed
This commit is contained in:
Ilya Gorbunov
2016-12-26 22:20:53 +03:00
parent d7885e699c
commit 5db75c993b
2 changed files with 26 additions and 0 deletions
@@ -24,6 +24,12 @@ import kotlin.comparisons.*
class CollectionTest {
@Test fun createListWithInit() {
val list = List(3) { index -> "x".repeat(index + 1) }
assertEquals(3, list.size)
assertEquals(listOf("x", "xx", "xxx"), list)
}
@Test fun joinTo() {
val data = listOf("foo", "bar")
val buffer = StringBuilder()