Differences between Arraylist vs Linkedlist Java Interview Questions | Vector vs Array | 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 : kzread.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
    @muneeswarip44742 жыл бұрын

    Thank you for the detailed information. Please share a video on microservices with different databases connection.

  • @_satveer
    @_satveer11 ай бұрын

    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

    11 ай бұрын

    😊👍

  • @mrrishiraj88
    @mrrishiraj882 жыл бұрын

    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
    @jainamdesai42302 жыл бұрын

    Thanks a lot ... All doughts are cleared about linkedlist and arraylist ..👍👍👌🙂

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Jainam 🙂👍

  • @badakh301
    @badakh301 Жыл бұрын

    i have learnt a lot from your vdos thank you

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks 🙂🙂

  • @jayalaxmirn9820
    @jayalaxmirn9820 Жыл бұрын

    very good contents and nice explaination. Please continue to give knowledge. And can we please get these ppt shared with us

  • @sourabhjinde8191
    @sourabhjinde81912 жыл бұрын

    Thanks. Questions like difference between hashmap &hashset, concurrentHashmap and synchronised , hashmap and linkedHashmap, etc.

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure thanks Sourabh 👍🙂

  • @paridhisingh_87
    @paridhisingh_877 ай бұрын

    Thank you so much !! :)

  • @CodeDecode

    @CodeDecode

    7 ай бұрын

    You're welcome!

  • @start1learn-n171
    @start1learn-n1714 ай бұрын

    Tq

  • @Sharma.Shivam
    @Sharma.Shivam2 жыл бұрын

    please explain differences between abstractlist and abstractsequentiallist

  • @divyeshakabari
    @divyeshakabari2 күн бұрын

    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

  • @Vithal_Nivargi
    @Vithal_Nivargi Жыл бұрын

    Thank you mam Nice explained 🥳

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    You're welcome

  • @kankipatiashok1168
    @kankipatiashok1168 Жыл бұрын

    could you please explain internal implementation ArrayList, LinkedList, HashMap,TreeMap

  • @aditigupta5324
    @aditigupta53242 жыл бұрын

    Very helpful videos

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks aditi 🙂👍

  • @maddalasatyanagendrabhaska9656
    @maddalasatyanagendrabhaska96562 жыл бұрын

    Very good explanation

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks 🙂👍

  • @ravikumark2023
    @ravikumark20239 ай бұрын

    you are the best

  • @CodeDecode

    @CodeDecode

    9 ай бұрын

    😊

  • @iloradas6387
    @iloradas63872 жыл бұрын

    Great video....can you also explain how lambda expression are handled during compile time please

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Nice topic IIora 👍🙂

  • @yatendra__singh
    @yatendra__singh2 жыл бұрын

    Hash map and hashset and concurrent map difference with example mam

  • @neelabhrai231
    @neelabhrai2312 жыл бұрын

    could you please put tutorial of any cloud technology

  • @ShanthiniSurendaranchannel133
    @ShanthiniSurendaranchannel1332 жыл бұрын

    Great

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks🙂👍

  • @deepikaupadhyay4868
    @deepikaupadhyay4868 Жыл бұрын

    Nice

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks

  • @ArjunSingh-is1bg
    @ArjunSingh-is1bg2 жыл бұрын

    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.

  • @vandanarani6074
    @vandanarani60742 жыл бұрын

    Difference Between Abstract class and Interface?

  • @technicalAjmul
    @technicalAjmul6 ай бұрын

    Good

  • @CodeDecode

    @CodeDecode

    6 ай бұрын

    Thanks

  • @mrrishiraj88
    @mrrishiraj882 жыл бұрын

    👍👍

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    🙂🙂

  • @islamiyazindagi6178
    @islamiyazindagi61782 жыл бұрын

    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 жыл бұрын

    kzread.info/head/PLyHJZXNdCXsfcMboYwGoL6wKAFPxljz5W

  • @amarthyaseshu683
    @amarthyaseshu6832 жыл бұрын

    💯

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Amarthya 🙂👍

  • @vaishnavi_cholli
    @vaishnavi_cholli2 жыл бұрын

    Good explanation

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks

  • @ITkedar
    @ITkedar2 жыл бұрын

    Mam pleased increase frequency of adding content...

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure Shubham 👍🙂

  • @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 🙂🙂