当前位置:网站首页>List and set

List and set

2022-07-06 11:51:00 monkeySix

List Orderly , repeatable

List Implementation class of

  1. ArrayList By name , As you can see , The bottom layer uses Array , Quick query , Add or delete slowly .
  2. LinkedList Know by name , The bottom layer uses linked lists , Slow query , Additions and deletions quickly .
  3. Vector The bottom layer uses arrays , Thread safety , Because the method has synchronized keyword , So it's thread safe .

Set disorder , Do not repeat

Set Implementation class of

  1. HashSet The bottom layer uses HashMap, use HashMap in key Storing data ensures the uniqueness of data .( disorder , Do not repeat )
  2. LinkedHashSet According to the name , The bottom layer uses linked lists and HashMap, The linked list ensures order .( Orderly , Not to be repeated )
  3. TressSet At the bottom are red and black trees .( Orderly , Do not repeat )
原网站

版权声明
本文为[monkeySix]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131614117737.html