Kotlin supports generics in functions to avoid code duplication. This is shown with the following code:
fun <T> genericFunction(t : T) {
println(t);
}
This function can be invoked as follows:
genericFunction("Shazin");
genericFunction(123);
Kotlin supports generics in functions to avoid code duplication. This is shown with the following code:
fun <T> genericFunction(t : T) {
println(t);
}
This function can be invoked as follows:
genericFunction("Shazin");
genericFunction(123);
3.147.66.128