function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
s-Forces-Force 

how to use collections of apex, i.e Sets & Lists

Hello

 

Please can anyone tell me how to use collections f apex, i.e. Sets & Lists. am new to salesforce and don't knw that much about sets & Lists. anyonetell me how we can declare thenm in apex clss or visualforce page? and how its work? and how to save the value of e.g. 5 sets in one list???

 

i want to create a 5 sets in one list , is that possible? and pls explain how to save that list ? if any one have example code then pls post that.

 

 

Thanks In advance.

prageethprageeth

Hello ;

Follow this URL and see under the topic 'Using Collections' for a begining. 

 http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_core_concepts.htm

 

Following also will help you.

 

List<String> myList = new List<String>();//Create a list of Strings
myList.add('Hello');//Add a string to string list
Set<String> mySet = new Set<String>();//Create a set of Strings
mySet.add('Hello');//Add a String to String set
List<Set<String>> setList = new List<Set<String>>();//Create a List of String Sets.
setList.add(mySet);//Add a set to the List of sets.