2

I receive this error:

Line: 5, Column: 4 unexpected token: '<'

When executing this code in the execute anonymous window in the developer console:

Map<String, List<Custom_Object__c>> idsToCustomObjectList = Map<String, List<Custom_Object__c>>();

Why do I get this error? How can I fix it?

15

The error is a little misleading. You are missing the new keyword when you assign idsToCustomObjectList.

Map<String, List<Custom_Object__c>> idsToCustomObjectList = new Map<String, List<Custom_Object__c>>();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.