【发布时间】:2012-09-06 13:38:41
【问题描述】:
以下代码
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;
}
给我
Compile Error: Invalid value type: String for Integer
在第 3 行
我想用一个值String 和另一个Integer 创建Map。该怎么做?
【问题讨论】:
-
错误说明了问题所在,您的 Map 是
并且您正在传递它 {String => String}。改为传递它 {String => Integer}。 -
@EricLeschinski:重点是
type是String。现在检查我的问题 -
不要在别人回答后改变问题的性质。
标签: salesforce apex-code