This does not compile:


val list : List<BigInteger> = Arrays.asList(BigInteger(“10”), BigInteger(“20”), BigInteger(“30”))

How can I make it compile?

Regards, Etienne


You could try this which is kooler

val list = arrayList(BigInteger("10"), BigInteger("20"), BigInteger("30"))

Whats the compile error on the previous code?


Type mismatch: inferred type is java.util.List<T>? but java.util.List<java.math.BigInteger> was expected


Yeah, most Java APIs by default are of type T? (i.e. that they are nullable). removing the explicit type or using List<BigDecimal?> would fix it


Got it. Thanks, James. (I had interpreted the ? in terms of Java generics...).

Btw, the question mark needs to be outside of the angled brackets.