File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 66
77[ HashMap和Hashtable的区别] ( #HashMap和Hashtable的区别 )
88
9- ## < font face = " 楷体 " > List,Set,Map三者的区别及总结</ font >
9+ ## List,Set,Map三者的区别及总结
1010- ** List:对付顺序的好帮手**
1111
1212 List接口存储一组不唯一(可以有多个元素引用相同的对象),有序的对象
1919 使用键值对存储。Map会维护与Key有关联的值。两个Key可以引用相同的对象,但Key不能重复,典型的Key是String类型,但也可以是任何对象。
2020
2121
22- ## < font face = " 楷体 " > Arraylist与LinkedList区别</ font >
22+ ## Arraylist与LinkedList区别
2323Arraylist底层使用的是数组(存读数据效率高,插入删除特定位置效率低),LinkedList底层使用的是双向循环链表数据结构(插入,删除效率特别高)。学过数据结构这门课后我们就知道采用链表存储,插入,删除元素时间复杂度不受元素位置的影响,都是近似O(1)而数组为近似O(n),因此当数据特别多,而且经常需要插入删除元素时建议选用LinkedList.一般程序只用Arraylist就够用了,因为一般数据量都不会蛮大,Arraylist是使用最多的集合类。
2424
25- ## < font face = " 楷体 " > ArrayList与Vector 区别(为什么要用Arraylist取代Vector呢?)</ font >
25+ ## ArrayList与Vector 区别(为什么要用Arraylist取代Vector呢?)
2626Vector类的所有方法都是同步的。可以由两个线程安全地访问一个Vector对象、但是一个线程访问Vector
2727,代码要在同步操作上耗费大量的时间。Arraylist不是同步的,所以在不需要同步时建议使用Arraylist。
2828
29- ## < font face = " 楷体 " > HashMap和Hashtable的区别</ font >
29+ ## HashMap和Hashtable的区别
30301 . HashMap是非线程安全的,HashTable是线程安全的;HashTable内部的方法基本都经过synchronized修饰。
3131
32322 . 因为线程安全的问题,HashMap要比HashTable效率高一点,HashTable基本被淘汰。
You can’t perform that action at this time.
0 commit comments