Professional Documents
Culture Documents
Day 15 - Collections in Apex - Map
Day 15 - Collections in Apex - Map
Day 15 - Collections in Apex - Map
===================
Collection of key-value pairs is called a Map
Syntax:
Memory Allocation:
Instance Methods:
studMap.put(1001, 'Suresh');
studMap.put(1002, 'Raj');
studMap.put(1005, 'Ramesh');
Collections Comparison
==============================
List Set
Map
----- ----
----
add(element) add(element)
put(key, value)
add(index, element) addAll(set2/list2) putAll(map2)
set(index, element) remove(element) keySet()
get(index) contains(element)
values()
remove(index) retainAll()
containsKey(key)
contains(element) isEmpty()
get(key)
isEmpty() size()
isEmpty()
size() clear()
size()
addAll(list2)
clear()
clear()