I have Any? coming from java and I would like to make a checked cast in order not to generate following warning:
Is it possible?
I have Any? coming from java and I would like to make a checked cast in order not to generate following warning:
Is it possible?
You can cast to Map<*, *>, but there's no way to check the type parameters. If you are sure that if it's a Map, then it's a Map<String, Any> (that is, all keys are Strings and values are never null) then just cast and suppress the warning with @Suppress("UNCHECKED_CAST").