Category: Salesforce Apex
-
Why is instanceof inconsistent in Apex collections?
Question In Apex, the following behavior seems inconsistent: My Question: Answer The Apex type system, particularly regarding collections like Map, Set, and List, has certain inconsistencies that can cause confusion. Consider the following code snippet: This behavior raises the question: Why does m instanceof Map<String, Object> evaluate to true, but m instanceof Map<Object, Object> evaluates…