How can I use vararg with different generics in Kotlin?
问题 I want to use vararg with generics with different types of each arguments what I've already tried: class GeneralSpecification<T> { fun <P> ifNotNullCreateSpec(vararg propToCreateFun: Pair<P?, (P) -> Specification<T>>): List<Specification<T>> = propToCreateFun.mapNotNull { (prop, funCreateSpec) -> prop?.let(funCreateSpec) } ... } but I can't use this like: ifNotNullCreateSpec("asdf" to ::createStringSpec, 5 to ::createIntSpec) (different types in vararg pairs) How can I use vararg with