
Java
hurusea
双手插袋,不要香菜
展开
-
vagrant下载centos镜像
vagrant init centos7 https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/CentOS-7.box vagrant up 使用中科大的镜像原创 2020-06-11 23:17:09 · 803 阅读 · 1 评论 -
为什么重写equals还要重写hashcode?举例论证说明分析得明明白白
object的equals默认是比较内存地址,hashcode默认是内存地址的哈希值,如果equals重写了,结果为true的两个对象并不一定内存地址一样(只是值相等),这个时候,如果不重写hashcode,那么他会默认用object的hashcode方法,因为地址不一样,所以他们的hashcode值是不一样的,这就导致两个对象equals相等但是hashcode不相等。当对象在hashmap中作...原创 2020-04-16 11:06:11 · 127 阅读 · 0 评论