why isn’t the return type `ImmutableList`?
# getting-started
s
why isn’t the return type
ImmutableList
?
m
stoyicker: because there's no such interface in Kotlin.
if (list !is MutableList) {
, it is, probably, immutable.
}
s
what does “probably” mean?
v
It means that implementation may be mutable, while the interface is read only
for example,
listOf
sometimes returns an immutable list, sometimes it returns an
ArrayList
, which is mutable, but still complies to read-only
List