8月21 从List中remove掉元素

一、从List中remove掉元素

            Iterator<ConditionBean_item> it = and.iterator();
            while(it.hasNext()){
                ConditionBean_item item = it.next();
                if("".equals(item.getValue()) || null == item.getValue()){
                    it.remove();
                }
            }

用Iterator 的方式比较好,如果用for循环会有问题

二、异常

Caused by: org.springframework.data.mapping.model.MappingException: Ambiguous field mapping detected! 
Both private java.lang.String cn.com.connext.commenservice.entity.mdm.ItemMaster.imgPath and

private java.lang.String cn.com.connext.mdm_module.vo.ItemListVo.imgPath map to the same field name imgPath!
Disambiguate using @Field annotation!

这是说属性重复了,

ItemMaster 和 ItemListVo 重复了imgPath
因为我是
ItemListVo 去继承了 ItemMaster ,结果master里有imgPath,Vo里面我又添加了imgPath

猜你喜欢

转载自www.cnblogs.com/lyon91/p/9509320.html