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

fuookami.ospf.kotlin.utils.operator.Eq.kt Maven / Gradle / Ivy

There is a newer version: 1.0.29
Show newest version
package fuookami.ospf.kotlin.utils.operator

interface PartialEq {
    infix fun partialEq(rhs: Self): Boolean?
}


interface Eq : PartialEq {
    infix fun eq(rhs: Self): Boolean {
        return (this partialEq rhs)!!
    }

    infix fun neq(rhs: Self): Boolean {
        return !(this eq rhs)
    }
}

infix fun > T?.partialEq(rhs: T?): Boolean? {
    return if (this == null && rhs == null) {
        true
    } else if (this != null && rhs != null) {
        this partialEq rhs
    } else {
        false
    }
}

infix fun > T?.eq(rhs: T?): Boolean {
    return if (this == null && rhs == null) {
        true
    } else if (this != null && rhs != null) {
        this eq rhs
    } else {
        false
    }
}

infix fun > T?.neq(rhs: T?): Boolean {
    return if (this == null && rhs == null) {
        false
    } else if (this != null && rhs != null) {
        this neq rhs
    } else {
        true
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy