![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java基础题
java面试题为主
你就是神
这个作者很懒,什么都没留下…
展开
-
Java Arraylist和Linkedlist的区别
https://blog.csdn.net/weixin_42468526/article/details/81178698 1、对于随机访问get和set,ArrayList优于LinkedList,因为LinkedList要移动指针。对于新增和删除操作add和remove,LinedList比较占优势,因为ArrayList要移动数据。 2、各自效率问题: 基于序号查找操作 顺序存储(时间复...转载 2020-04-10 21:49:23 · 226 阅读 · 0 评论 -
hashcode()方法与equal和“==”
为什么要重写hashcode()方法 hashCode是从Object默认继承来的,它基于对象ID实现,如果你重写了equals,比如说是基于对象的内容实现的,而保留hashCode的实现不变,那么很可能某两个对象明明是“相等”,而hashCode却不一样。 这样,当你用其中的一个作为键保存到hashMap、hasoTable或hashSet中,再以“相等的”找另一个作为键值去查找他们的时候,则根...转载 2020-04-10 21:29:06 · 114 阅读 · 0 评论