I would do something along the lines of ```inline ...
# codingconventions
c
I would do something along the lines of
Copy code
inline fun ifNoneAreNull(vararg args: Any?, operation: (args: Array<out Any>) -> Unit) {
	@Suppress("UNCHECKED_CAST")
	if (null !in args) operation(args as Array<out Any>)
}

//usage
ifNoneAreNull("a", "b", 3, null) { args ->
	args.forEach (::println)	
}
But if your use case is exactly like you described above, your solution looks ok and is better (if arguably less flexible) than mine.
👍 1