why do i hav to cast this in my Kotlin generic
still trying to get the hang of generics in kotlin, i how can i write this to avoid the unchecked cast.
class DBEntityUtil {
fun entityListToModelList(entityList:List): List{
val returnList:MutableList = mutableListOf()
entityList.forEach{entity:T ->
returnList.add(entity.toModel() as S)
}
return returnList
}
}
and the toModel()
interface IngestsModel {
fun toModel(): Model
}