在Map <map <string,string =“”>&gt;的Map <string,string =“”>中添加更多键值对迭代列表

时间:2015-07-10 14:55:11

标签: java list dictionary

我得到List&lt;地图&lt;字符串,字符串&gt; &GT;来自API。我需要遍历List中的每个地图元素,并在Map中添加更多项目。

以下是我的工作方式。

List<Map<String, String>> list = someAPI.getList();
for(Map<String, String> m : list )
{
    m.put("Key1", "Value1" );
    m.put("Key2", "Value2" );
};

return( list );

当我从函数返回列表时,它没有&#34; Key1&#34; - &GT; &#34;值1&#34;地图中的值。它具有来自API的原始价值。我希望使用这些键值对更新列表中的地图元素。

任何建议?

0 个答案:

没有答案
相关问题