Joe
03/26/2018, 6:41 PMif (!(raw instanceof Map)) {
...
}
And here’s the converted Kotlin:
if (raw !is Map<*, *>) {
...
}
Now the variable raw is actually of type LinkedHashTreeMap which inherits from Map. What am I missing?ilya.gorbunov
03/26/2018, 6:46 PMJoe
03/26/2018, 6:47 PMraw isn’t a Map).Joe
03/26/2018, 6:48 PMilya.gorbunov
03/26/2018, 6:49 PMLinkedHashTreeMap inherit from java.util.Map?Joe
03/26/2018, 6:51 PMLinkedHashTreeMap extends AbstractMap, which in turn implements Map.Joe
03/26/2018, 6:52 PMLinkedHasTreeMap wasn’t from the standard Java library. But yes, Map is the ultimate interface.Shawn
03/26/2018, 6:53 PMJoe
03/26/2018, 6:54 PMShawn
03/26/2018, 6:54 PMJoe
03/26/2018, 6:58 PMraw looks like this at runtime:
raw = {LinkedHashTreeMap@7019} size = 3
0 = {LinkedHashTreeMap$Node@7026} "data" -> " size = 3"
1 = {LinkedHashTreeMap$Node@7027} "data_type" -> "current_power"
2 = {LinkedHashTreeMap$Node@7028} "data_id" -> "84b1a48c-44df-4e80-bfaf-ffe024846126"ilya.gorbunov
03/26/2018, 6:59 PMINSTANCEOF java/util/Map check and then going to the branch if the result is false.Joe
03/26/2018, 7:01 PM