Wednesday, January 18, 2023

Set in Salesforce

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);

No comments:

Post a Comment