Smartcast for map containsKey

In essence what you are saying is that there is no guarantee ever that a value in a map is not null.
What i do not understand then is how the type inference can ever tell me its a non nullable value in the map.
The type inference in essence tells me that if the key exists the value must also exist. Hence my idea for a smartCast :slight_smile:
The smartcast is based upon the structure of the map not on the method that is being called (even if the jvm can in essence return null)

I do understand that you cannot effectively guarantee that a method call returns null or not in following calls. But to be clear its the datastructure that provides the boundry of not being able to add null values not the method.

Well maybe i just do not know enough about this stuff to be able to determine/see what is possible and what is not.