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

fuookami.ospf.kotlin.utils.functional.Condition.kt Maven / Gradle / Ivy

The newest version!
package fuookami.ospf.kotlin.utils.functional

data class Condition(
    val value: T,
    val predicate: Predicate
) {
    val result: Boolean by lazy { predicate(value) }

    fun asNull(): T? = if (predicate(value)) null else value
}

fun  T.ifTrue(predicate: Predicate) = Condition(this, predicate)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy