All Downloads are FREE. Search and download functionalities are using the official Maven repository.

run.smt.ktest.util.lambda.overloaded.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package run.smt.ktest.util.lambda

class SingleArgumentLambda internal constructor(private val original: (T?) -> R) {
    operator fun invoke(param: T) = original(param)
    operator fun invoke() = original(null)
}

class DualArgumentLambda internal constructor(private val original: (A?, B?) -> R) {
    operator fun invoke() = original(null, null)
    operator fun invoke(a: A) = original(a, null)
    operator fun invoke(a: A?, b: B) = original(a, b)
}

fun  ((T?) -> R).overloaded() = SingleArgumentLambda(this)
fun  ((A?, B?) -> R).overloaded() = DualArgumentLambda(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy