Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- Write a program in Apex to count a total number of duplicate elements in an array.
- String[] inputArr = ['A','B','C','D','A','C','A','B','E','F','H','E','I'];
- Output will be a map, which will contain Element and the count.
- 2.
- Write a program in Apex to find all unique elements in an array.
- String[] inputArr = ['A','B','C','D','A','C','A','B','E','F','H','E','I'];
- Find-out unique element from the given array.
- 3.
- Write a program in apex to find the maximum and minimum element in a Map.
- Test data:
- Map<String, Integer> inputMap = new Map<String, Integer>{'A' => 10, 'B' => 20, 'C' => 30,'D'=>25,'F'=>9};
- Find-out maximum and minimum value from the example data input.
- 4.
- Write a program in apex to find the od and even element from a Map. and create two different map for odd and even.
- Map<String, Integer> inputMap = new Map<String, Integer>{'A' => 10, 'B' => 11, 'C' => 12,'D'=>14,'F'=>16};
- Output will be two Map, one for odd elements map, another one for even element map.
- 5.
- Write a program in apex to find matching records from two map and create anoter map with matched value from input maps.
- Map<String, String> nameCodeMap = new Map<String, String>{'PRV' =>'Parvez', 'KSR' => 'Kausar', 'YZ' => 'Yousuf','RZ'=>'Reza','ZKR'=>'Zakir'};
- Map<String, String> nameDistrictMap = new Map<String, String>{'PRV' =>'Chandpur', 'KSR' => 'Barura', 'YZ' => 'Daudkandi','RZ'=>'Manikganj','ZKR'=>'BBaria'};
- Map<String, String> namePlatformMap = new Map<String, String>{'PRV' =>'PHP', 'KSR' => 'PHP', 'YZ' => 'Java','RZ'=>'Test','ZKR'=>'Salesforce'};
- Map<String, String> nameCompanyMap = new Map<String, String>{'PRV' =>'Bangal', 'KSR' => 'Shohoj', 'YZ' => 'Innovitio','RZ'=>'BJIT','ZKR'=>'Arollo'};
- Cross-check and print list of names for each user.
- Example output:
- Kausar, KSR, Barura, PHP, Shohoj.
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement