Reputation: 1925
I know it's probably a stupid question, but I can't figure how to create a generic function in Kotlin.
I'm new to Kotlin, but I'm pretty sure it's possible.
I already tried:
fun T GetContent(call: ApplicationCall) : T
and:
fun GetContent<T>(call: ApplicationCall) : T
I Tried searching online and in Stack Overflow questions.
I even looked at the documentation here
I think I'm missing something, because it's supposed to be simple!
Anyway, any help will be highly appreciated!
Upvotes: 1
Views: 66
Reputation: 489
Directly from the site you quoted:
fun <T> singletonList(item: T): List<T> {
// ...
}
It's just the wrong syntax ;)
Upvotes: 3