Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Differentiate between List, Set and Map in Salesforce

Be First!
by October 7, 2012 Uncategorized

Differentiate between List, Set and Map in Salesforce

List:
List is a ordered collection of values. It contains duplicate values. Each value is retrieved using the List Index.
Ex:
List<String> countryList = new List<String>();
countryList.add(‘India’);
countryList.add(‘USA’);
countryList.add(‘UK’);

Set:
Set is an unordered collection of values. It does not contains duplicate values.

Ex:
Country (Key) ‘United States’ ‘Japan’ ‘France’ ‘England’ ‘India’
Currency (Value) ‘Dollar’ ‘Yen’ ‘Euro’ ‘Pound’ ‘Rupee’

Map:
Map is a key value pair datatype.

(343)

Previous
Next

Leave a Reply