Ofir Bar
03/24/2020, 10:17 PMCasey Brooks
03/24/2020, 10:21 PMhey
, because you declared it to be String
(non-null). In the second example, the type parameter could be anything, including a nullable type. val s: String? = null; s.doOrLog()
is valid, type type parameter is just String?
instead of String
. You’d have to give the type parameter a bound of T : Any
to declare that the type parameter should be non-nullableOfir Bar
03/24/2020, 10:22 PM