The method put is not applicable for the arguments
HashMap<?,?>m=newHashMap<String,ArrayList<String>>();ArrayList<String>l=newArrayList<...
HashMap<?, ?> m = new HashMap<String, ArrayList<String>>();
ArrayList<String> l = new ArrayList<String>();
l.add("aaa");
m.put("a", l);
The method put(capture#10-of ?, capture#11-of ?) in the type HashMap<capture#10-of ?,capture#11-
of ?> is not applicable for the arguments (String, ArrayList<String>) 展开
ArrayList<String> l = new ArrayList<String>();
l.add("aaa");
m.put("a", l);
The method put(capture#10-of ?, capture#11-of ?) in the type HashMap<capture#10-of ?,capture#11-
of ?> is not applicable for the arguments (String, ArrayList<String>) 展开
1个回答
2013-02-01
展开全部
Map<String, ArrayList<String>> m = new HashMap<String, ArrayList<String>>();
追问
因为我可能要这样用
HashMap m = null;
if(是否是多个值)
{
m = new HashMap();
m.put("a", "aaa");
}
else
{
m = new HashMap>();
ArrayList l = new ArrayList();
l.add("aaa");
m.put("a", l);
}
但我不想在两个地方声明.
追答
汗。。。。。Map m=null; 试试!
Map m=new HashMap();
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询