You need to sign in to do that
Don't have an account?
prasanth puvvada 4
please explaint map with integer, account
i am not able to understand Map<Integer, List<Account>>
If this is >>>>>>>> Map<Integer, Account> the map.put(1,name='prasanth'); map.put(2,name='kiran'); is this line is correct?
please explaing example for Map<Integer, List<Account>> . Thanks in advance.
I understoond map<id, account> and please tell map<id,list<account>> thanks in advance.
If this is >>>>>>>> Map<Integer, Account> the map.put(1,name='prasanth'); map.put(2,name='kiran'); is this line is correct?
please explaing example for Map<Integer, List<Account>> . Thanks in advance.
I understoond map<id, account> and please tell map<id,list<account>> thanks in advance.
Map<Integer, Account> mapAccount = new Map<Integer, Account>();
mapAccount.put(1, new List<Account>() { new Account(Name="TestAccount") });
If its helps, please mark as best answer so it will help to other who will serve same problem.
Thanks!
Hello,
Map<Integer,List<Account> is the combination of key and value pair. Where key is the integer means any index number as well value is the list of account records. So below is the example to prepare map of index number(Integer) and accounts.
Suppose you have list of account and from that list you need to prepare map.
Assume that in your account list you have AcountNumber field which have number values like 0,1,2,3...
And about you line
If this is >>>>>>>> Map<Integer, Account> the map.put(1,name='prasanth'); map.put(2,name='kiran'); is this line is correct?
- It is not correct, you need to have correct format as Shrikant suggested.
About map<id,list<account>>
- You can understand that map based on above example.
Thanks & Cheers,
Jigar (pateljb90@gmail.com)
In below code you are storing Account Detail base on number. Please read below post that will help you.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_map.htm
If you want to use below line meanse you want to store list of account base on number.
Map<Integer, List<Account>> map = new Map<Integer, List<Account>>();
Both are valid code.
Please let us know if this will help you.