If you access a Java value of type List<[Some Type]>
in Kotlin, you will get the type (Mutable)List<[Some Type]!>!
.
e.g.:
Java code:
public class Example {
public static List<String> getList() {
return Arrays.asList("A", "B", "C");
}
}
Kotlin code:
val list = Example.getList()
// list is of type (Mutable)List<String!>!
Here is, how IntelliJ shows it:
However, if you want to make your own variable of this type like so:
val list2: (Mutable)List<String>
Then IntelliJ will correctly highlight the type but will give the error Unexpected Tokens
.
What is this (Mutable)List
?