Java generics to kotlin
Sun, Aug 28, 2016Generics code of java was expressed using the reified of kotlin.
# Java
public <T extends BaseCode> T getCode(Class<T> type) {
return (T) codes.get(type);
}
# Kotlin
inline fun <reified T : BaseCode> Code.system() = getCode(T::class.java)