Integer类之equals与hashCode

伢赞

关注

阅读 106

2022-08-03

一、源码。

1、equals源码。可以看出,比较的是两者的类型相同且内容相同。即是否有相等的int类型的value值。

Integer类之equals与hashCode_其它

##############################################################################################

Integer类之equals与hashCode_其它_02

##############################################################################################

Integer类之equals与hashCode_其它_03

 

2、hashCode源码。可以看出Integer对象的哈希值是其存储的int类型的value值大小

 

Integer类之equals与hashCode_其它_04

###############################################################################################

Integer类之equals与hashCode_其它_05

 

二、


精彩评论(0)

0 0 举报