Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Collections/Apex/collections-1.apex
Normal file
4
Task/Collections/Apex/collections-1.apex
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Create an empty list of String
|
||||
List<String> my_list = new List<String>();
|
||||
// Create a nested list
|
||||
List<List<Set<Integer>>> my_list_2 = new List<List<Set<Integer>>>();
|
||||
6
Task/Collections/Apex/collections-2.apex
Normal file
6
Task/Collections/Apex/collections-2.apex
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
List<Integer> myList = new List<Integer>(); // Define a new list
|
||||
myList.add(47); // Adds a second element of value 47 to the end
|
||||
// of the list
|
||||
Integer i = myList.get(0); // Retrieves the element at index 0
|
||||
myList.set(0, 1); // Adds the integer 1 to the list at index 0
|
||||
myList.clear(); // Removes all elements from the list
|
||||
3
Task/Collections/Apex/collections-3.apex
Normal file
3
Task/Collections/Apex/collections-3.apex
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
String[] colors = new List<String>();
|
||||
List<String> colors = new String[1];
|
||||
colors[0] = 'Green';
|
||||
3
Task/Collections/Apex/collections-4.apex
Normal file
3
Task/Collections/Apex/collections-4.apex
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Set<String> s1 = new Set<String>{'a', 'b + c'}; // Defines a new set with two elements
|
||||
Set<String> s2 = new Set<String>(s1); // Defines a new set that contains the
|
||||
// elements of the set created in the previous step
|
||||
4
Task/Collections/Apex/collections-5.apex
Normal file
4
Task/Collections/Apex/collections-5.apex
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Set<Integer> s = new Set<Integer>(); // Define a new set
|
||||
s.add(1); // Add an element to the set
|
||||
System.assert(s.contains(1)); // Assert that the set contains an element
|
||||
s.remove(1); // Remove the element from the set
|
||||
3
Task/Collections/Apex/collections-6.apex
Normal file
3
Task/Collections/Apex/collections-6.apex
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Map<String, String> country_currencies = new Map<String, String>();
|
||||
Map<ID, Set<String>> m = new Map<ID, Set<String>>();
|
||||
Map<String, String> MyStrings = new Map<String, String>{'a' => 'b', 'c' => 'd'.toUpperCase()};
|
||||
7
Task/Collections/Apex/collections-7.apex
Normal file
7
Task/Collections/Apex/collections-7.apex
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Map<Integer, String> m = new Map<Integer, String>(); // Define a new map
|
||||
m.put(1, 'First entry'); // Insert a new key-value pair in the map
|
||||
m.put(2, 'Second entry'); // Insert a new key-value pair in the map
|
||||
System.assert(m.containsKey(1)); // Assert that the map contains a key
|
||||
String value = m.get(2); // Retrieve a value, given a particular key
|
||||
System.assertEquals('Second entry', value);
|
||||
Set<Integer> s = m.keySet(); // Return a set that contains all of the keys in the map
|
||||
Loading…
Add table
Add a link
Reference in a new issue