Collection-rev
Linked_listA A
Collection-rev

Linked_listA A
- linked list is a type of data structure implemented as a doubly linked list in which each element is stored inside a node object.
- Each node consists of three parts:
- previous node addr → data → next node addr
*Advantages
- fast insertion ->no sifting the lement ike arraylist
- fast deletion ->
- no fixed capacity /dynamic size *dis
- Slow searching, unlike an ArrayList, in which traversing is by index
- Random access is slow
- Take extra memory while in a node object, it consists of previous us addr →data →next node addr
Give a real-life example of using a linked list
- Browsing history like next page ←> previous page
- music playlist
- undo redo feature
/Synchronization is a mechanism used to ensure only one thread can access the shared resource or object at a time, making a program ahead-of-time safe and preventing inconsistency
//Non-synchronization is used to ensure that multiple threads can access the same resources simultaneously It is a faster, more performance-efficient
How to make a linked list as asynchronous
List list =Collection.syncronizedList(new LinkedList<>());

Vector — — — — — — — — — — — Vectoror is a legacy class that implements the List interface
It stores the element in a dynamic array
- maintain insertion order, allows duplicate and null values, and synchronized + thread safe
- Java internally uses a dynamic array means in the array becomes full, if u add more element no need to again intialzation; it will automatically increase the size of the array to double and then store the element into a new array
- Java is synchronized in nature and thread-safe
- initial and default capacity of vector is 10, if we increase the size, the value becomes double
- Yes, we can store the null & duplicate values in a vector
Constructors in a vector class :
- default constructor -creates the empty vector with an initial capacity of 10 — Vector list =new Vector<>();
- initial capacity constructor -create a vector with capacity -Vector list =new Vector<>(20
- initial capacity + increment constructor -same as before, but addition of increment by the value -Vector list =new Vector<>(20,5); // 5 is increment
- Collection constructor — Creates a Vector containing all elements from another collection -Vector vector = new Vector<>(list);
메타데이터
- post_id
- 09b65c32e440
- slug
- collection-rev-09b65c32e440
- url
- https://medium.com/@amn24/collection-rev-09b65c32e440
- canonical_url
- https://medium.com/@amn24/collection-rev-09b65c32e440
- author_url
- https://medium.com/@amn24
- status
- ok
- fetched_at
- 2026-08-26 10:47:08