遇到的問題: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