Differences between Arraylist vs Linkedlist Java Interview Questions | Vector vs Array | Code Decode

  Рет қаралды 78,366

Code Decode

Code Decode

Күн бұрын

It covers live demo and in depth explanation of very frequently asked differences like Array VS ArrayList, ArrayList Vs Vector and ArrayList Vs LinkedList.
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
Difference between Array and ArrayList.
Array is static in size.
ArrayList is dynamic in size. It can be resized itself when needed.
Array is a fixed length data structure
ArrayList is a variable length Collection class.
An array can store both objects and primitives type.
We cannot store primitive type in ArrayList. It automatically converts primitive type to object.
It performs fast in comparison to ArrayList because of fixed size.
resize() operation : Automatic resize will slow down the performance as it will use temporary array to copy elements from the old array to new array.(by 50%)
add() or get() operation : almost same performance , as for ArrayList object these operations run in constant time.
It is mandatory to provide the size of an array while initializing it directly or indirectly.
We can create an instance of ArrayList without specifying its size. Java creates ArrayList of default size.
We use for loop or for each loop to iterate over an array.
We can use an iterator also to iterate over ArrayList.
Array provides a length variable which denotes the length of an array.
ArrayList provides the size() method to determine the size of ArrayList.
Array can be multi-dimensional.
ArrayList is always single-dimensional.
the elements are contained in adjacent memory locations.
the objects are incapable of being contained in contiguous locations.
The assignment operator is put to use for the storage of elements.
The add() attribute is utilized for the insertion of elements in an ArrayList.
Generics are not compatible with Arrays.
ArrayLists allow the use of Generics.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Difference between ArrayList and Vector
ArrayList is not synchronized.
Programmers prefer ArrayList over Vector because ArrayList can be synchronized explicitly using Collections.synchronizedList.
Vector is synchronized.
Not Thread Safe
Thread Safe
ArrayList is fast because it is non-synchronized.
.
ArrayList increments 50% of current array size
Vector increments 100% means doubles the array size.
Iterating Values
.
------------------------------------------------------------------------------------------------------------------------------------------------
Difference between ArrayList and LinkedList
ArrayList internally uses a dynamic array to store its elements.
LinkedList uses Doubly Linked List to store its elements.
ArrayList implements only List.
LinkedList implements List as well as Queue. It can acts as a queue as well.
Manipulation with ArrayList is slow because it internally uses an array. If any element is removed from the array, all the other elements are shifted in memory.
LinkedList is slower than ArrayList in storing and accessing data as access requires node by node traversal.
there is no descendingIterator() in ArrayList
LinkedList can be iterated in reverse direction using descendingIterator()
If the constructor is not overloaded , then ArrayList creates an empty list of initial capacity 10
There is no case of default capacity in a LinkedList. Hence an empty list is created when a LinkedList is initialized.
In ArrayList Memory overhead is less as each index only holds the actual object(data).
Memory overhead in LinkedList is more as compared to ArrayList as node in LinkedList needs to maintain the addresses of next and previous node.
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
SQL Playlist : • SQL Interview Question...
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : kzfaq.info?...
LinkedIn : / codedecodeyoutube
Instagram : / codedecode25
#codedecode #javacollectioninterviewquestion #topjavacollectioninterveiwquestion #javainterviewquestion

Пікірлер: 62
@7_bairapraveen928
@7_bairapraveen928 Жыл бұрын
The unique thing about your tutorial is we get to see the actual implementation of framework. Rather than just remembering keywords like synchronised,legacy etc
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 😊😊
@muneeswarip4474
@muneeswarip4474 2 жыл бұрын
Thank you for the detailed information. Please share a video on microservices with different databases connection.
@_satveer
@_satveer Жыл бұрын
One of the best explanation as I often thought as of adding element at the end or middle in linked list would be slower but now it’s easier😊
@CodeDecode
@CodeDecode Жыл бұрын
😊👍
@mrrishiraj88
@mrrishiraj88 2 жыл бұрын
Great tutorials with demonstration from you.... always. Gratitude!
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Rishi 🙂👍
@mrrishiraj88
@mrrishiraj88 11 ай бұрын
@@CodeDecode welcome
@shefalibhargava1937
@shefalibhargava1937 Жыл бұрын
Great tutorials. Learnt alot from your videos. Can you please explain the time complexity for ArrayList and LinkedList ?
@jainamdesai4230
@jainamdesai4230 2 жыл бұрын
Thanks a lot ... All doughts are cleared about linkedlist and arraylist ..👍👍👌🙂
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Jainam 🙂👍
@jayalaxmirn9820
@jayalaxmirn9820 Жыл бұрын
very good contents and nice explaination. Please continue to give knowledge. And can we please get these ppt shared with us
@sourabhjinde8191
@sourabhjinde8191 2 жыл бұрын
Thanks. Questions like difference between hashmap &hashset, concurrentHashmap and synchronised , hashmap and linkedHashmap, etc.
@CodeDecode
@CodeDecode 2 жыл бұрын
Sure thanks Sourabh 👍🙂
@badakh301
@badakh301 Жыл бұрын
i have learnt a lot from your vdos thank you
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂🙂
@iloradas6387
@iloradas6387 2 жыл бұрын
Great video....can you also explain how lambda expression are handled during compile time please
@CodeDecode
@CodeDecode 2 жыл бұрын
Nice topic IIora 👍🙂
@kankipatiashok1168
@kankipatiashok1168 Жыл бұрын
could you please explain internal implementation ArrayList, LinkedList, HashMap,TreeMap
@paridhisingh_87
@paridhisingh_87 7 ай бұрын
Thank you so much !! :)
@CodeDecode
@CodeDecode 7 ай бұрын
You're welcome!
@Vithal_Nivargi
@Vithal_Nivargi Жыл бұрын
Thank you mam Nice explained 🥳
@CodeDecode
@CodeDecode Жыл бұрын
You're welcome
@Sharma.Shivam
@Sharma.Shivam 2 жыл бұрын
please explain differences between abstractlist and abstractsequentiallist
@aditigupta5324
@aditigupta5324 2 жыл бұрын
Very helpful videos
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks aditi 🙂👍
@maddalasatyanagendrabhaska9656
@maddalasatyanagendrabhaska9656 2 жыл бұрын
Very good explanation
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks 🙂👍
@ArjunSingh-is1bg
@ArjunSingh-is1bg 2 жыл бұрын
Thank Mam For this Java Interview Questions and ans Series. Can You make videos on the Sonar Lint Issues and how can we resolve sonar issues in the code, I know that you definately works on that.
@CodeDecode
@CodeDecode 2 жыл бұрын
True that Arjun. We all do work with sonar cloud or sonar lint. Without that none of our code is deployed on AWS/ azure . If you follow coding best practices you will have least code smells . We will surely create videos on Java best practices 🙂👍
@ArjunSingh-is1bg
@ArjunSingh-is1bg 2 жыл бұрын
@@CodeDecode If Possible mam , please make videos on that actually i am also working on that and need some help from your guidence.
@islamiyazindagi6178
@islamiyazindagi6178 2 жыл бұрын
Mam, thank you for this video but plz explain all java 8 coding interview questions like find name who has 2nd highest salary, or salary greater then 2.5k and so on questions plz
@CodeDecode
@CodeDecode 2 жыл бұрын
kzfaq.info/sun/PLyHJZXNdCXsfcMboYwGoL6wKAFPxljz5W
@neelabhrai231
@neelabhrai231 2 жыл бұрын
could you please put tutorial of any cloud technology
@ravikumark2023
@ravikumark2023 10 ай бұрын
you are the best
@CodeDecode
@CodeDecode 10 ай бұрын
😊
@start1learn-n171
@start1learn-n171 5 ай бұрын
Tq
@yatendra__singh
@yatendra__singh 2 жыл бұрын
Hash map and hashset and concurrent map difference with example mam
@vandanarani6074
@vandanarani6074 2 жыл бұрын
Difference Between Abstract class and Interface?
@divyeshakabari
@divyeshakabari 17 күн бұрын
sorry but i think when the arraylist gets full at that time it uses one formula to resize the list and that is n+(n/2)+1 so suppose we have 10 elements right now the moment we try to add 11th element at that time it will be resized to 16 not to 15. because it uses this formula to resize the list internally
@mrrishiraj88
@mrrishiraj88 2 жыл бұрын
👍👍
@CodeDecode
@CodeDecode 2 жыл бұрын
🙂🙂
@ITkedar
@ITkedar 2 жыл бұрын
Mam pleased increase frequency of adding content...
@CodeDecode
@CodeDecode 2 жыл бұрын
Sure Shubham 👍🙂
@amarthyaseshu683
@amarthyaseshu683 2 жыл бұрын
💯
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Amarthya 🙂👍
@ShanthiniSurendaranchannel133
@ShanthiniSurendaranchannel133 2 жыл бұрын
Great
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks🙂👍
@vaishnavi_cholli
@vaishnavi_cholli 2 жыл бұрын
Good explanation
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks
@deepikaupadhyay4868
@deepikaupadhyay4868 Жыл бұрын
Nice
@CodeDecode
@CodeDecode Жыл бұрын
Thanks
@technicalAjmul
@technicalAjmul 6 ай бұрын
Good
@CodeDecode
@CodeDecode 6 ай бұрын
Thanks
@arvindsingh-br4zt
@arvindsingh-br4zt Жыл бұрын
Array list size is increasing by (previous_size*3/2)+1
@CodeDecode
@CodeDecode Жыл бұрын
👍👍
@rishiraj2548
@rishiraj2548 Жыл бұрын
I can trust only two for Java: Oracle (Sun Microsystems), and Code Decode Even when I fail to understand what is explained. When any of these two says something about a Java concept, it is surely true. Gratitude for the awesome and very helpful content!
@CodeDecode
@CodeDecode Жыл бұрын
Means a lot to us Rishi 🙂🙂
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 19 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 79 МЛН
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
11:43
Coding with John
Рет қаралды 581 М.
14.5 LinkedList vs ArrayList in Java
9:16
Telusko
Рет қаралды 406 М.
ARRAYLIST VS LINKEDLIST
21:20
Core Dumped
Рет қаралды 55 М.
Linked Lists for Technical Interviews - Full Course
1:27:24
freeCodeCamp.org
Рет қаралды 351 М.
MUST KNOW junior role JAVA interview questions
42:15
Keep On Coding
Рет қаралды 107 М.