// "Create extension function 'List.foo'" "true" open class A fun main(args: Array) { val list = listOf(1, 2, 4, 5) list.foo { object : A() {} } } private fun List.foo(function: () -> A) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. }