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
Edward chanEdward chan 

Need more details of the event

Hi,
Do you have more details to this method/event
products.add

 

which does appear below, from the Merchandise tutorial of Developer force?

 

public DisplayMerchandise[] getProducts() {
if (products == null) {
products = new DisplayMerchandise[]{};
for (Merchandise__c item :
[SELECT id, name, description__c, price__c
FROM Merchandise__c
WHERE Total_Inventory__c > 0]) {
products.add(new DisplayMerchandise(item));
}
}
return products;
}

 

Many Thanks & Best Regards,
Edward Chan

Prafull G.Prafull G.
Hi Edward

add() is a list method. In the above code sample, products is defined as List/Array of DisplayMerchandise type.

The statement
products.add(new DisplayMerchandise(item));
is adding elements to the list products. For more details on this method
Click the link
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_list.htm

Cheers!
Edward chanEdward chan
Sorry, I cannot go to your url.
Prafull G.Prafull G.
OK. Just google 'list methods salesforce apex' and the first link will be the above one.

The same you can find in salesforce pdf as well.
Search of 'List Methods' in salesforce_apex_language_reference.pdf

Hope it works!