e.ultra.mutator.0.76.0.source-code.common.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mutator Show documentation
Show all versions of mutator Show documentation
"Make immutable objects mutable"
The newest version!
package de.peekandpoke.ultra.mutator
typealias OnModify = (newValue: T) -> Unit
infix fun X.isSameAs(other: X) = !isNotSameAs(other)
@Suppress("USELESS_CAST")
infix fun X.isNotSameAs(other: X) = when {
this == null -> other != null
other == null -> true
else -> {
val cls = (this as Any)::class
when {
cls == String::class -> this != other
cls.javaPrimitiveType != null -> this != other
else -> this !== other
}
}
}