遇到的问题:map.get(0) = null,而map.get(0L) =100
Map<Long,Double> CategoryMoney = new HashMap<>(); // map中通过ItemMoney对象插入了几条数据,其中一条为:0 -》100 if(CategoryMoney.get(0L) != null){ vo.setCombo(CategoryMoney.get(0L)); totalMoney += CategoryMoney.get(0L); } public class ItemMoney { private double money; private Long superior; public ItemMoney(){ } public ItemMoney(double money,Long superior){ this.money = money; this.superior = superior; } }
Integer与Long的区别:https://blog.csdn.net/bigtree_3721/article/details/74573840