In Apex, arrays are collections of elements of the same type that are stored sequentially in memory. Each element in the array is accessed by an index, which starts from zero. Although Apex does not have a true “array” data type, the List data type in Apex is similar in behavior and can be used in much the same way as an array.
Example
|
|
These all method actually behave the same.
You can even do this
|
|
What is the difference then?
Array looking List cannot be used for nested arrays - arrays of arrays are not permitted in Apex.
But!
You can achieve this with List<Type>
.
Example:
|
|
Cheer! 🍺