I have got a list of SObjects having N number of items/sObjects SObject[] sList = [sobject1, sboject2, sboject3, ........ , sobjectN]
How can I get just 10 items from the begining of the list
Thanks in advance!
After running this code newList contains only first 10 objects from sList.
SObject[] sList = [sobject1, sboject2, sboject3, ........ , sobjectN];
List<SObject> newList = new List<SObject>();
for(Integer i = 0; i< 10;i++){
newList.add(sList[i]);
}
For more info please reffer to List documentation