Skip to content

Instantly share code, notes, and snippets.

@seanpat09
Created October 9, 2015 21:23
Show Gist options
  • Save seanpat09/8e2453c9a9104dd991e3 to your computer and use it in GitHub Desktop.
Save seanpat09/8e2453c9a9104dd991e3 to your computer and use it in GitHub Desktop.
Salesforce Map Case-Sensitivity Inconsistency
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
System.assert( gd.ContainsKey('CampaignMember') );
System.assert( gd.ContainsKey('campaignmember') );
System.assert( gd.ContainsKey('CAMPAIGNMEMBER') );
System.assert( gd.keyset().contains('campaignmember') );
System.assert( !gd.keyset().contains('CampaignMember') );
System.assert( !gd.keyset().contains('CAMPAIGNMEMBER') );
Map<String, String> colors = new Map<String,String>{
'Red' => '#FF0000'
};
System.assert( colors.ContainsKey('Red') );
System.assert( !colors.ContainsKey('red') );
System.assert( !colors.ContainsKey('RED') );
System.assert( colors.keyset().contains('Red') );
System.assert( !colors.keyset().contains('red') );
System.assert( !colors.keyset().contains('RED') );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment