本文参考 本篇文章参考自<Effective Java>第三版第十条"Obey the general contract when overriding equals" the conditions when each instance of the class is equal only to itself Each instance of the class is inherently unique -- 类的每一个实例本就彼此不同,例如Thread类,每一个线程仅和自…
本文参考 本篇文章参考自<Effective Java>第三版第十一条"Always override hashCode when you override equals" You must override hashCode in every class that overrides equals hashCode()方法的通用约定如下: When the hashCode method is invoked on an object repeatedly during…