Activity › Forums › Salesforce® Discussions › What is the use of clear() in Salesforce? Salesforce® Discussions What is the use of clear() in Salesforce? Posted by Marziya on May 21, 2020 at 1:56 PM What is the use of clear() in Salesforce? Ayush replied 6 years ago 4 Members · 3 Replies 3 Replies Shweta Member May 21, 2020 at 2:39 PM clear() is used to removes all elements from a list, consequently setting the list’s length to zero [adinserter block='9'] Kirandeep Member May 22, 2020 at 1:15 PM Clear is predefined method of List class which removes all elements from a list. Ayush Member May 26, 2020 at 7:51 AM used to remove all of the elements from the List container. This method does not deleted the List container, instead it justs removes all of the elements from the List. Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me