![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SE-Map
xingyuner2
这个作者很懒,什么都没留下…
展开
-
Map与List查找性能比较
@Test public void mapTest(){ /* * 比较顺序查找和散列查找的性能 */ //创建线性表集合 List list= new ArrayList(); //创建散列表集合 Map map= new HashMap(); //向集合中同时添加数据 for(int i=0; i Strin转载 2017-09-15 22:33:37 · 15688 阅读 · 1 评论 -
重写equals 和 hashCode
重要: 使用HashMap时候, 作为key类, 必须合理重写hashCode() 和 equals, 否则会引用HashMap各种故障!!!package day05;public class Point { private int x, y; public Point(int x, int y) { this.x = x; this.y = y; }转载 2017-09-15 23:23:31 · 161 阅读 · 0 评论 -
Map的几种迭代器遍历方式
package day05;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Map.Entry;import java.util.Set;/* * map 的迭代 */public class MapIteratorDemo {转载 2017-09-20 16:53:25 · 2471 阅读 · 0 评论