Hullaballoonatic
04/11/2019, 8:28 PMMutableList
both an interface and a class in the stdlib without their names clashing? Do they have separate jvmNames?Shawn
04/11/2019, 8:30 PMHullaballoonatic
04/11/2019, 8:32 PMclass foo<T>(data: MutableList<T>): MutableList<T> by data {
}
And you can only delegate to interfaces.
And I can also write this:
val foo = MutableList(10) { it + 2 }
What is going on here? Is the second not an invocation?Shawn
04/11/2019, 8:33 PMCollections.kt
dalexander
04/11/2019, 8:34 PMpublic inline fun <T> MutableList(size: Int, init: (index: Int) -> T): MutableList<T> {
val list = ArrayList<T>(size)
repeat(size) { index -> list.add(init(index)) }
return list
}
Hullaballoonatic
04/11/2019, 8:34 PMdalexander
04/11/2019, 8:35 PMnew
operator constructor calls are indistinguishable from function calls.Shawn
04/11/2019, 8:36 PMMutableList
invocation in italics, much like static methods in java or like extension functions (without the orange text color anyhow)Hullaballoonatic
04/11/2019, 8:36 PMopen
classes whenever possible, so I'm trying to use delegation to implement wrapper classes succinctly.Al Warren
04/11/2019, 10:18 PMHullaballoonatic
04/11/2019, 10:20 PMMutableList
is just an extension of Java's ArrayList
with the kotlin stdlib collections functions addedAl Warren
04/12/2019, 1:08 AMelizarov
04/13/2019, 7:49 AMAl Warren
04/14/2019, 3:27 PM