Set in Salesforce

By | March 3, 2020

Set

  1. It doesn’t allow duplicates.
  2. It maintains dictionary order.
  3. Set maintains hash code mechanism.
  4. It allows only one null value.

Syntax

set<Datatype> variable name = new set<Datatype>();

Methods

  1. Add(Element);
  2. addAll(list/set s);
  3. contains(Element);
  4. containsAll(set/list s);
  5. size();
  6. clear();
  7. remove(Element);

Leave a Reply

Your email address will not be published. Required fields are marked *