Merge pull request #5692 from alimate/BAEL-2374

BAEL-2374: Added a simple reified generic example
This commit is contained in:
Loredana Crusoveanu
2018-11-15 20:26:56 +02:00
committed by GitHub
@@ -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>())
}