Activity Forums Salesforce® Discussions In salesforce What are the different type of Collections you can have in Apex?

  • Achintya

    Member
    August 23, 2019 at 4:57 am

    Collections in Apex can be lists, sets, or maps.
    There is no limit on the number of items a collection can hold. However, there is a general limit on heap size.
    Lists
    A list is an ordered collection of elements that are distinguished by their indices. List elements can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.
    Sets
    A set is an unordered collection of elements that do not contain any duplicates. Set elements can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.
    Maps
    A map is a collection of key-value pairs where each unique key maps to a single value. Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.
    Parameterized Typing.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos