Sitemap

Collection-rev

2 min readJun 23, 2026

--

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

Get Aman Verma’s stories in your inbox

Join Medium for free to get updates from this writer.

//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 :

  1. default constructor -creates the empty vector with an initial capacity of 10 — Vector list =new Vector<>();
  2. initial capacity constructor -create a vector with capacity -Vector list =new Vector<>(20
  3. initial capacity + increment constructor -same as before, but addition of increment by the value -Vector list =new Vector<>(20,5); // 5 is increment
  4. Collection constructor — Creates a Vector containing all elements from another collection -Vector vector = new Vector<>(list);

--

--

Aman Verma
Aman Verma

Written by Aman Verma

📚#Software Engineer || Ai Technolgy || #ReadingIsLife || #techylife https://blog-project-one-silk.vercel.app/