The following code
public List<Map<String,String>> getPhoneData() {
List<Map<String, String>> mapp = new List<Map<String, String>>();
Map<String, Integer> temp
= new Map<String, Integer>{'type' => 'Profile Value', 'count' => 1};
return mapp;
}
is giving me
Compile Error: Invalid value type: String for Integer
at line 3
I want to create Map
with one value String
and other Integer
. How to do that?
Remove the quotes from around the numbers like this:
Map<String, Integer> temp = new Map<String, Integer>{'type' => 123, 'count' => 1};
EDIT: As you changed your question completely, the best way of achieving this would be:
public List<Map<String,String>> getPhoneData() {
List<Map<String, String>> mapp = new List<Map<String, String>>();
Map<String, String> temp = new Map<String, String>{'type' => 'Profile Value', 'count' => '1'};
return mapp;
}