fun foo(resources: List) { resources.map { runCatching { it } }.mapNotNull { it.getOrNull() } } fun bar(resources: List) { resources.map { runCatching { it } }.mapNotNull { it.getOrNull() } }