BAEL-2374: Added a simple reified generic example.
This commit is contained in:
parent
42fac5dbcf
commit
927a8851ae
|
@ -0,0 +1,6 @@
|
|||
inline fun <reified T> Iterable<*>.filterIsInstance() = filter { it is T }
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val set = setOf("1984", 2, 3, "Brave new world", 11)
|
||||
println(set.filterIsInstance<Int>())
|
||||
}
|
Loading…
Reference in New Issue