StavFX
01/17/2018, 1:57 AMit == obj
- the only caveat is that if it
and obj
are both null
- you'll get true
.
If that's not desired, then this would yield the same result as the original code it != null && it == obj
spragg
01/17/2018, 2:09 AMit
and obj
are of the same type. Using equals allows for a custom comparison function. In this case I have a custom data class which I want to support a comparison to an ID of type Long.Shawn
01/17/2018, 2:20 AM==
translate to a .equals()
call in Kotlin?StavFX
01/17/2018, 4:20 AMa == b
and a.equals(b)
are identical.
@spragg if you want the java "==" you'll have to use === in kotlin.spragg
01/17/2018, 4:29 AMnull
, and since that is taken care of by what == is translated to. I can do what I need by just having a == b