CLOVIS
04/11/2020, 4:41 PMSomething<?>
to say that the generic is ignored. Is there any similar syntax in Kotlin? If so, where can I find documentation that explains how to use it?Ashish Kumar Joy
04/11/2020, 4:41 PMAshish Kumar Joy
04/11/2020, 4:42 PMSam Garfinkel
04/11/2020, 4:55 PMDominaezzz
04/11/2020, 5:02 PMSomething<*>
• Something<Any>
• Something<Unit>
• Something<Nothing>
Depends on what ignore means I guess.streetsofboston
04/11/2020, 5:12 PM*
means out Any?
for covariant type parameters (when getting a value, you can safely assign it to a variable of type Any?
) or in Nothing
for contravariant type parameters (there is no safe way to set a value safely).
If you are planning to never call any methods that use a type-parameter on an interface having that type parameter, use *
for that type parameter fro the declaration of your variable/parameter/property.