用HashSet的add方法谈hashcode和equals方法重写

Set<UnlockGood> unlockgoods = new HashSet<UnlockGood>(); UnlockGood good = new UnlockGood("a",1,2); unlockgoods.add(good); UnlockGood good1 = new UnlockGood("a",1,12); unlockgoods.add(good1); UnlockGood good2 = new UnlockGood("b",1,2); unlockgoods.add(good2);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23f93fea38879a0517e931d0772e0ba6.html