ClaudiuB
fun isObjectOfSameType(first: Comparable?, second: Comparable?) : Boolean { return first::class.java.isAssignableFrom(second) }
javaClass
::class.java
Nullable
Alan Evans
fun isObjectOfSameType(first: Comparable<*>?, second: Comparable<*>?): Boolean { if (first == null && second == null) { return true } if (first == null || second == null) { return false } return first::class.java.isAssignableFrom(second::class.java) }
A modern programming language that makes developers happier.