#12 - Difference b/w ConcurrentHashMap & SynchronizedMap in Java || (HashTable vs HashMap)

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 81

  • @sureshgarine
    @sureshgarine 4 ปีที่แล้ว +16

    I would say one word --- "AWESOME". I remember my days of engineering - studied about Operating Systems - process synchronization. Thank you for the lucid explanation.

    • @jatinsharma3792
      @jatinsharma3792 2 ปีที่แล้ว

      I wish that I would have studied Computer Science it’s attractive branch, I am enjoying learning now.

  • @harithasri8372
    @harithasri8372 2 ปีที่แล้ว +2

    Naveen totally addicted to your videos. Ur videos are simply awesome for complete beginners. Many channels explain about put and add method or about null values and null keys. But if u take a concept u will be true to urself and with us and explain everything about it. Thank you so much.

  • @viveksrivastava4264
    @viveksrivastava4264 3 ปีที่แล้ว +2

    Aisa koi engineering college me padha deta to maazzaa aa jata.....
    You are really really amazing ... Itne simple words me koi bhi nai bata sakta.... :)

  • @pablo-escobar-here
    @pablo-escobar-here 5 หลายเดือนก่อน +1

    if providing detailed explanation is an art that you are the Picasso of it Naveen!! Thank You very much😊

  • @gopalpandurangan9768
    @gopalpandurangan9768 3 ปีที่แล้ว +5

    Thanks, Naveen for your wonderful demonstration on this Topic.

  • @Fortheluvoffood
    @Fortheluvoffood 2 ปีที่แล้ว +3

    Really enjoying these series... used to run away from this topic while prepping but you have made it really very easy to understand.. thanks a ton

  • @nobleman2704
    @nobleman2704 ปีที่แล้ว +1

    best explained ever
    tbh. I would suggest to explain it by saying bucket instead of segment

  • @tkk1369
    @tkk1369 ปีที่แล้ว +1

    wow!!!To the point :)

  • @kanakalakshmimurikipudi1536
    @kanakalakshmimurikipudi1536 หลายเดือนก่อน

    Explanation is Clear👍

  • @simm5622
    @simm5622 2 ปีที่แล้ว +1

    Thank you so much, you made it super easy to understand. 🏆🏆🏆🏆🏆

  • @dharanyuvi6951
    @dharanyuvi6951 2 ปีที่แล้ว +1

    Really a great thanks Naveen bro.., Information like these are gem 🥰

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 3 ปีที่แล้ว +2

    Super amazing. Thanks a lot for this premium content.

  • @RahulKumar-xu4ft
    @RahulKumar-xu4ft 3 ปีที่แล้ว +2

    Thank u so much from the bottom of my heart.....such a way u hv explained Amazing keep on...

  • @Vithal_Nivargi
    @Vithal_Nivargi 2 ปีที่แล้ว +1

    first time I entered your channel I felt awesome content!
    Thank you so much for your effort

  • @2anshumansehgal
    @2anshumansehgal 4 ปีที่แล้ว +1

    Thanks Naveen for this video..super important

  • @MrAsgar123
    @MrAsgar123 2 ปีที่แล้ว +1

    Awesome Explain. Thank you so much

  • @vipulrohilla1383
    @vipulrohilla1383 2 ปีที่แล้ว

    Thanks for explaining this wonderfully.

  • @alokprajapati4504
    @alokprajapati4504 3 ปีที่แล้ว

    I think this is the best explanation, and cleared the concept.

  • @13success66
    @13success66 2 ปีที่แล้ว

    Very beautiful explanation thanks a lot

  • @keplerk
    @keplerk 2 ปีที่แล้ว

    Info i didn't know i needed to know, thanks !

  • @Trulycandidly
    @Trulycandidly 7 วันที่ผ่านมา

    Thankyou Naveen❤

  • @jackcoolguy123
    @jackcoolguy123 2 ปีที่แล้ว

    Awesome explanation.
    Just one correction. HashMap was there before JDK 1.5 too.
    I had given SCJP for jdk 1.4 and HashMap was there.

  • @sriram6148
    @sriram6148 2 ปีที่แล้ว

    Great work! Good job!!
    Note: hashmap was introduced in 1.2 itself. Pls add atleast a note in your video so that people are not misguided.

  • @softwaredevnk166
    @softwaredevnk166 2 ปีที่แล้ว

    Nice explanation. Thanks!!

  • @monumoon5515
    @monumoon5515 3 ปีที่แล้ว +1

    really ur so talented

  • @santhoshsandeep
    @santhoshsandeep 4 ปีที่แล้ว +2

    Thanks for the topic Naveen bro#naveen👍

  • @fathimasyed4232
    @fathimasyed4232 2 ปีที่แล้ว

    clear explanation .. great !!

  • @nikhilninawe7648
    @nikhilninawe7648 3 ปีที่แล้ว

    Thanks u saved my life

  • @jatinsharma3792
    @jatinsharma3792 3 หลายเดือนก่อน

    Beautifull...

  • @keerthu7055
    @keerthu7055 ปีที่แล้ว

    great explanation bro:)

  • @nivedaravi2241
    @nivedaravi2241 3 ปีที่แล้ว

    Great explanation. Surprised. Just subscribed.

  • @Thd369
    @Thd369 ปีที่แล้ว

    Thank you so much.

  • @yaswanthravuri8450
    @yaswanthravuri8450 3 ปีที่แล้ว

    Nice explanation

  • @WMohanty
    @WMohanty 3 ปีที่แล้ว

    amazing, get well soon thanks

  • @HungNguyen-nd6tz
    @HungNguyen-nd6tz 3 ปีที่แล้ว +1

    Many thanks (y)

  • @Pakhichetna
    @Pakhichetna 2 ปีที่แล้ว

    @Naveen
    When I'm using below code snippet to print key and value of syncMap, I'm getting NoSuchElementException. Can you please help?
    Iterator itr = syncMap.entrySet().iterator();
    while(itr.hasNext()) {
    System.out.println("key = "+itr.next().getKey()+" Value = "+itr.next().
    getValue()); }

  • @zhaoqingchris
    @zhaoqingchris 3 ปีที่แล้ว

    Amazing video, however Segment lock was abandoned since Java 8, it now uses CAS + Synchronisation to guarantee thread safety

    • @irckdwrld
      @irckdwrld 3 ปีที่แล้ว +1

      Can you please explain segment level locking (till java7) vs Bucket level locking (in java8). Thanks in advance!!

  • @danceayush8128
    @danceayush8128 3 ปีที่แล้ว

    Great job 👍

  • @kingajable
    @kingajable 3 ปีที่แล้ว

    superb

  • @svalyavasvalyava9867
    @svalyavasvalyava9867 ปีที่แล้ว

    thank you so much!!!

  • @anjanaraja43
    @anjanaraja43 ปีที่แล้ว

    Hi naveen.. Clear crisp 👏
    I have some doubt.
    If one thread writing/ updating data to segment one and
    Another thread accessing data from another segment same point of time...
    So there is a chance of in accuracy right..
    Is there any solution

  • @meenakshibhasin9456
    @meenakshibhasin9456 2 ปีที่แล้ว

    Hi sir, in case of concurrentHashMap if all the buckets are writing and one more thread wants to write so it will wait for one of the thread to be free ?

  • @pranjal.sharma
    @pranjal.sharma 3 ปีที่แล้ว

    very helpful 👏👏👏

  • @swapnilsam5164
    @swapnilsam5164 3 ปีที่แล้ว

    Awesome 😎

  • @archu4cts
    @archu4cts 3 ปีที่แล้ว

    Awesome

  • @amritasharma5390
    @amritasharma5390 3 ปีที่แล้ว +1

    Thank you 😊

  • @vsprasadavantsa7203
    @vsprasadavantsa7203 ปีที่แล้ว

    Thanks

  • @irckdwrld
    @irckdwrld 3 ปีที่แล้ว +1

    @Naveen AutomationLabs Thanks for the awesome explanation😊Just subscribed😁
    Can you please explain segment level locking (till java7) vs Bucket level locking (in java8). Thanks in advance!!

  • @srianshworld3942
    @srianshworld3942 3 ปีที่แล้ว

    great explanation

  • @vengateshm2122
    @vengateshm2122 3 ปีที่แล้ว +1

    How to prevent concurrent modification exception in arraylist?

  • @SurajYadav-yd2cu
    @SurajYadav-yd2cu 2 ปีที่แล้ว

    what if two threads try to access same segement ...... wil it not throw concurrentModiificationexception at that time .....................

  • @parulgarg7429
    @parulgarg7429 3 ปีที่แล้ว +1

    how to ensure for the other threads to read the updated value in the segment if one thread is writing at the same time in concurrent hash map.

    • @irckdwrld
      @irckdwrld 3 ปีที่แล้ว +2

      I know it's late, but could be a reference for future viewers.... The "Reading" thread/s can directly read from ConcurrentHashMap. If there is/are update operation(s) happening at same segment/bucket, after all the update operations only, the read operation/thread can execute. We don't have to do anymore settings.
      As from JavaDocs of SE8 version:
      More formally, an update operation for a given key bears a happens-before relation with any (non-null) retrieval for that key reporting the updated value.

    • @parulgarg7429
      @parulgarg7429 3 ปีที่แล้ว

      @@irckdwrld Thanks doubt..cleared

  • @abdularsath2715
    @abdularsath2715 3 ปีที่แล้ว

    Amazing naveen when will you post like this for python .

  • @sarthakbrahmbhatt1092
    @sarthakbrahmbhatt1092 2 ปีที่แล้ว

    I think there is issue when collision occurs and if particular bucket is locked by another thread then it must wait . Otherwise next time when we find value of index or bucket address with hascode it will point to same index where it should be or value wont be able to be found. I am just asking.

  • @chandrasekhar5858
    @chandrasekhar5858 2 ปีที่แล้ว

    After loosing interview, i landed here 🙏🙏🙏🙏🙏

  • @pratapjavasingh3239
    @pratapjavasingh3239 3 ปีที่แล้ว

    Few doubt why only one null key introduce in a hashmap not the multiple and this is the same functionality why not implemented hash table can u tell me answer Naveen sir and also usecases? don't say legacy reason respective of hashtable

  • @krishnakasam5725
    @krishnakasam5725 3 ปีที่แล้ว

    what happens when more than 16 threads are trying to write on 16 segments of the object in concurrent hashmap?

  • @chandansharma6849
    @chandansharma6849 3 ปีที่แล้ว

    Sir i have a doubt please help me ......
    If i deploy my application on the server and then every user will get a thread of application......
    If there is any synronised map then only one user have lock on it no other user can access utill first user leave .....
    Or syncronised map is safe from sub threads of main thread which every user get on server.....
    Please clear my doubt sir..

  • @ashuiet
    @ashuiet 4 ปีที่แล้ว

    What is EnumMap and How to use in real time scenarios

  • @catmom6572
    @catmom6572 2 ปีที่แล้ว

    Great work! Reminds me of my professor Dr. Subir in U of Windsor.

  • @dipukumar-wd6ys
    @dipukumar-wd6ys 3 ปีที่แล้ว

    Hi sir, I have one doubt on concurrenthashmap suppose in one segment can it allow two thread for Two operation (like read, write) ?

  • @DeepakVishwakarma-uv4yr
    @DeepakVishwakarma-uv4yr 3 ปีที่แล้ว

    Sir, what will be the virtual capacity once 16 indexes of nodes are filled? For e.g In ArrayList if I add more values than the default capacity i.e 10 My virtual capacity becomes 15, 22, and so on. What will be the virtual capacity of the HashMap once go beyond the default virtual capacity?

    • @cinthiyavincent9527
      @cinthiyavincent9527 2 ปีที่แล้ว

      Each node create a balanced binary tree once the threshold value reached I guess

  • @satishkoppisetty927
    @satishkoppisetty927 3 ปีที่แล้ว

    segment and bucket both refer to same component ? someone please help

  • @rubyyadav935
    @rubyyadav935 3 ปีที่แล้ว

    Vedio 13,14 is not there... Directly 15 vedio (hashmap interview questions is listed)... And please make a vedio for fast-fail and fast-safe..,comparator ane comparable..

  • @vlvn0191
    @vlvn0191 3 ปีที่แล้ว +1

    5:00

  • @sanketnegi1
    @sanketnegi1 3 ปีที่แล้ว

    I am looking for advantages of synchronised over concurrent..
    1. It allows null values and 1 null key.
    2. Consistency is weak in concurrent.
    I want to understand what does this weak consistency mean

  • @ImranKhan-mc6vf
    @ImranKhan-mc6vf 2 ปีที่แล้ว

    Confused a bit, so when we say ConcurrentHashMap is divided in 16 segments and a thread tries to write to it, does it mean it is writing in "Key", "Value" pair (for an instance, "Key1", "Value1").
    If it is so, what happens let's say 2nd thread goes to write "Key1", "Value2" to the map simultaneously and new segment is provided for it to write? Does the map has 2 same keys now, which I believe not is the case, so what exactly is happening?

    • @subhrajyotiroy1471
      @subhrajyotiroy1471 2 ปีที่แล้ว

      I guess when another thread goes to write "Key1", "Value2", it will generate same hashcode and then navigate to same index which currently earlier thread is using and this is locked by thread 1. So when writing operation is done by thread1, thread2 will update the value there.

  • @rahulsoni-lx5rb
    @rahulsoni-lx5rb 3 ปีที่แล้ว

    🙌awsmmm!

  • @RaviKumar-lg7hu
    @RaviKumar-lg7hu 3 ปีที่แล้ว

    You should tell "not syncronized means".
    Not "syncronized means" @ 00:28

  • @arnavpatil583
    @arnavpatil583 4 ปีที่แล้ว

    ConcurrentModificationException

  • @ameynaik2743
    @ameynaik2743 3 ปีที่แล้ว

    How is it taking care of this th-cam.com/video/UwurUtvil7w/w-d-xo.html ?