当前位置:网站首页>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 

边栏推荐
- 1000 okaleido tiger launched binance NFT, triggering a rush to buy
- 关 于 路 由
- Seektiger's okaleido has a big move. Will the STI of ecological pass break out?
- [freeswitch development practice] column introduction
- Review questions of polymer synthesis technology
- Establishment of static route
- Jianzhi offer 05 two stacks to realize the queue
- Basic exercises of C language for beginners
- Determination of host byte order
- Solve the problem that MySQL inserts Chinese garbled code into the table
猜你喜欢

Seektiger's okaleido has a big move. Will the STI of ecological pass break out?

Axure implements addition, deletion, modification and query

Sublime text 3 汉化+添加常用插件

A little understanding of encoder

HCIP实验

Create.Img image file

C language database: detailed description. Use the student management system to understand the operation of the database, which is simple and easy to understand.

The flare project celery uses the pits encountered in redis sentinel

Navicat for MySQL installation tutorial

Client does not support authentication protocol requested by server; consider upgrading MySQL client
随机推荐
1000 okaleido tiger launched binance NFT, triggering a rush to buy
Hypothesis test of Pearson correlation coefficient
Create.Img image file
Openresty模板实时渲染 lua-resty-template
Idea setting automatic package import and useless package deletion
Understanding of flexible array in C language
Group chat room based on UDP
The winverifytrust call returned 80096005 error. The timestamp signature or certificate cannot be verified or is damaged
免费学习机器学习交易的资源
Establishment of static route
Bubble sort, quick sort
Kubernetes deployment dashboard (visual interface)
Sublime text 3 汉化+添加常用插件
Repeat one sentence Trojan horse
Three usages of synchronized keywords in vernacular
1000 okaleido tiger launched binance NFT, triggering a rush to buy
SQL CASE 多条件用法
【云原生之kubernetes】kubernetes集群下的Deployment高级资源对象管理
Concept, key points and summary of postgraduate entrance examination in Polymer Physics
Linkerd service grid survey notes