RosettaCodeData/Task/Arrays/Apex/arrays-2.apex

5 lines
265 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
List <Integer> aList = new List <Integer>(); // optionally add an initial size as an argument
aList.add(5);// appends to the end of the list
aList.add(1, 6);// assigns the element at index 1
System.debug(list[0]); // Prints 5, alternatively you can use list.get(0)