diesieben07
05/06/2017, 2:48 PMokkero
05/07/2017, 7:53 AMK
. Because there is no way to infer that from context.diesieben07
05/07/2017, 2:48 PMokkero
05/07/2017, 4:01 PMfun <K, M : Map<out K, *>> TypeToken<M>.keyType(): TypeToken<K> {
(Note the out
variance)
The reason you don't have to do that with elementType
is because List
already declares its type parameter as covariant. Map
does not do this, so you have to explicitly state that.diesieben07
05/07/2017, 4:35 PM