RosettaCodeData/Task/Arrays/Apex/arrays-2.apex
2016-12-05 23:44:36 +01:00

4 lines
265 B
Text

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)