14

为什么系列之重写equals方法必须重写hasCode方法?-爱咖啡

 4 years ago
source link: https://blog.51cto.com/4837471/2447956
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Object源代码及注释equals是Object的公有方法,那么我们通常都会在自己的类中重写这个equals方法,同时必须重写hasCode方法,知道为什么重写equals方法必须重写hasCode方法呢?/***Returnsahashcodevaluefortheobject.Thismethodis*supportedforthebenefitofhashtablessuchasthose

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK