Merge pull request #5692 from alimate/BAEL-2374
BAEL-2374: Added a simple reified generic example
This commit is contained in:
commit
60697a321c
|
@ -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