Map<String,Object> map = Maps.newHashMap();
map.put("test","123");
map.put("fuyou001","456");
map.put("id",145);
List<Map<String,Object>> list = Lists.newArrayList();
list.add(map);
Lists.transform(list, new Function<Map<String, Object>, Object>() {
@Override
public Object apply(@Nullable Map<String, Object> input) {
System.out.println("test:" + input);
return input;
}
});
System.out.println(list);`
控制台不显示“测试....”
如何避免偷懒
我也试试
List<Map<String,Object>> newList = new ArrayList<Map<String, Object>>(list.size());
Collections.copy(newList,list);
但不影响