is there a reason why emptyList has a type paramet...
# announcements
y
is there a reason why emptyList has a type parameter and couldnt just return List<Nothing>?
d
I think it's mostly convenience.
val emptyStringList: List<String> = emptyList()
vs.
val emptyStringList = emptyList<String>()
­čĄĘ 1
b
There is an issue related to this: https://youtrack.jetbrains.com/issue/KT-1215, that would allow default type parameters. In this case
emptyList
could be defined as
fun emptyList<T = Nothing>()
. Andrey Breslav said that this is might be part of 1.4: https://discuss.kotlinlang.org/t/allow-typealias-to-have-the-same-name-as-generic-class/6789/9?u=wasabi375)