You need to sign in to do that
Don't have an account?
Mahesh Nirmal
Adding Values to Map.
I have two List
List<String> filteredValues = New List<String>();
List<Contract__c> valuesForfilteredValues = something query.
And I have to add them to a map
Map<String, String> detailsMap;
How should I do that.
Scenario.
Let's Say-
The first list has values (Name, City, State);
Second List has values (TestName, Mumbai, MH);
I have to perform dynamically as-
detailsMap.put(Name , TestName);
detailsMap.put(City , Mumbai);
detailsMap.put(State , MH);
Please suggest a way to do this.
try this
Let me know, if it's helps you and do best mark.
Thank You
All Answers
If the sceanrio is that the name city and state keys are repeated then you won't be able to use a map as the keys in the map needs to be unique if that is the case then I would suggest you to have a key that is unique like Mumbai and then the value would be list of parameters.
For example:
Map<String, List<String>> detailsMap = new Map<String, List<String>>();
List<String> ls1 = new List<String>();
ls1.add('Test Name');
ls1.add('Mumbai');
ls1.add('MH');
detailsMap.put('Mumbai',ls1);
Please note the above is an example and you will have to modify it as per your use case.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
try this
Let me know, if it's helps you and do best mark.
Thank You