Browse topics
Functional Kotlin
Generics
Generic functions, classes, constraints, variance and star projection.
kotlin genericsGeneric Functions in KotlinGeneric functions work with multiple types using type parameters. A Kotlin example with source code and sample output.kotlin genericsGeneric Classes in KotlinGeneric classes store values of parameterized types. A Kotlin example with source code and sample output.kotlin genericsType Constraints in KotlinType constraints limit generic type parameters. A Kotlin example with source code and sample output.kotlin genericsVariance in out in Kotlinout makes type parameter covariant (producer). A Kotlin example with source code and sample output.kotlin genericsStar Projection in KotlinStar projection () is used when generic type argument is unknown. A Kotlin example with source code and sample output.
Related topics
Lambda Expressions Lambda syntax, parameters, return values and anonymous functions. Higher Order Functions Functions as parameters, inline functions and return types. Scope Functions let, run, with, apply and also scope functions explained. Delegates Property delegates, lazy, observable and class delegation. Extension Functions Add new behaviour to existing types with Kotlin extension functions and properties.