Generic function :
fun <T> List<T>.itemAt ( position : Int) : T {
return this[position]
}
Generic class :
class Library <T> ( private books: List<T>) {
val last : T? get () = books.lastOrNull()
}
More examples here
Generic function :
fun <T> List<T>.itemAt ( position : Int) : T {
return this[position]
}
Generic class :
class Library <T> ( private books: List<T>) {
val last : T? get () = books.lastOrNull()
}
More examples here