当前位置:网站首页>Interview question: what are the differences between ArrayList and LinkedList
Interview question: what are the differences between ArrayList and LinkedList
2022-07-24 01:18:00 【Flying page】
One 、 Their underlying data structures are different
ArrayList The underlying layer of is implemented by arrays , It can be seen from the source code :
LinkedList The bottom layer of is based on linked list , Because the linked list is composed of multiple nodes , The cells of the linked list are nodes , Look at the source code :
Two 、 Two classes implement List Interface , however LinkedList It's also achieved Deque Interface
ArrayList Class implements the List Interface , Take a look at the source code :
public class ArrayList<E> extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, java.io.Serializable
{
................
LinkedList Not only has List Interface , It's also achieved Deque Interface , So it can also be used as a double ended queue
public class LinkedList<E>
extends AbstractSequentialList<E>
implements List<E>, Deque<E>, Cloneable, java.io.Serializable
{
................
3、 ... and 、 Different scenarios
ArrayList The bottom layer is based on the array implementation , So the query is relatively fast ,
Adding and deleting are slow , Because it may involve an expansion operation 
LinkedList The bottom layer is based on linked list , So it is more suitable for adding and deleting 

边栏推荐
- EasyExcel导出案例(只有你想不到)
- [QNX hypervisor 2.2 user manual]9 VM configuration reference
- C language: student management system based on sequence table, super detailed, all with notes, if you don't understand it after reading, please slap me.
- IDEA 编译器 设置方法之间分割线隔开
- docker redis
- Solve the problem that the double click of Google Chrome browser doesn't respond and can't be started (friendly testing)
- 1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
- Scroll View implémente la mise à jour déroulante (empêche onload d'entrer dans la page de mise à jour initiale du Shell Triggered pour déclencher la mise à jour déroulante pour True)
- 对皮尔逊相关系数进行假设检验
- HCIP实验
猜你喜欢

Good doctor consultation - Yu Chi - oral information

Solve the problem that MySQL inserts Chinese garbled code into the table

Answer to the short answer question of polymer synthesis technology

Matlab提取论文插图中原始数据—Fig2Data工具

面试题之:ArrayList和LinkedList有哪些区别

What impact does the European "gas shortage" have on China?

Collation of key knowledge of high voltage technology

Repeat one sentence Trojan horse

Idea setting automatic package import and useless package deletion

Create a self signed certificate to digitally sign exe files
随机推荐
Concurrent programming 1-2
HCIP实验
Hot 100 depth first
HCIP网络类型,ppp会话,数据链路层协议
Dynamic rip configuration
Scroll view realizes drop-down refresh (to avoid the drop-down problem triggered by the initial refresh triggered value of true when onload enters the page)
Hcip, OSPF comprehensive experiment
HCIP实验
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Kubernets déploiement du tableau de bord (interface visuelle)
[QNX hypervisor 2.2 user manual]9.1 configuration variables
[STM32] basic knowledge of serial communication
Review questions of polymer synthesis technology
Detailed explanation of OSPF in hcip
ACL——net
HCIP中的MGRE GRE OSPF过程
HCIP,OSPF综合实验
1000 okaleido tiger launched binance NFT, triggering a rush to buy
Polymer synthesis technology
Preprocessing instruction define, do you really understand?