HashTable vs HashMap vs Concurrent HashMap all kinds of Map implementations

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • In JDK you have a lot of map implementations that you did not know even existed like EnumMap, IdentityHashMap and a lot of other implementations that are favorites of interviewers. In this video I am exploring various implementations available, and compare and contrast them with very good examples on WeakHashMap and ConcurrentHashmap.
    #hashmap #hashcode #java #javaprogramming #hashtable #macbookair #easy #javainstitute #javascript #class #computerprogramming #beginners #learnjava #learn #study #freshers #interview #fypシ #fypシ゚viral #trending #fyp #interviewtips #interviewquestions #mustwatch #usa #india #global #viral

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

  • @bhagyashreedhavalshankh8452
    @bhagyashreedhavalshankh8452 7 ปีที่แล้ว +114

    Why did u stop making more tutorials ! Please keep up this amazing work.

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

      I think he got a job at Google to be honest with you.

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

      +1, he was doing so great with the content.

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

      @@The64v :( Really !

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

    Just came across, this actually seems like a really good channel. Simple, detailed & easy to understand explanations.

  • @gunturmanju
    @gunturmanju 6 ปีที่แล้ว +12

    Awesome Tutorial. I always watch these before i take interviews. Thank you !! Please kindly post more :)

  • @betowarrior_
    @betowarrior_ 7 ปีที่แล้ว +6

    Kudos, very well explained videos. I'm diving deep into the concurrent api and anything that has to do with multithreading and its really a whole new world.

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

    amazing, better explanation with good graphics. very easy to understand.

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

    Please make more videos.Your explanation is crystal clear.

  • @SonysonyYnos
    @SonysonyYnos 7 ปีที่แล้ว +3

    so fantastic explanation! I love your code examples, very intuitive to follow and have an idea of what's going on. Keep up your good work!

  • @basics201
    @basics201 8 ปีที่แล้ว +7

    ur teaching way is good ..please make a video on threading in full details.

  • @RajVerma-go4xk
    @RajVerma-go4xk 8 ปีที่แล้ว +12

    Hi ranjith this video is intersting. please let me know when u r going upload new videos for design patterns, i am waiting eagerly. previous design pattern videos are good.

  • @cimbonda24
    @cimbonda24 8 ปีที่แล้ว

    I watched 4 videos man...your channel is unique...precious detail...everybody is used to present only outside the box...I like you present under the hood java...Thanks

  • @pranjalahluwalia
    @pranjalahluwalia 6 ปีที่แล้ว

    Don't have words to appreciate your work. Watched around tons of videos but only you had clarity. Thank you so much for your wonderful insight, watched all your videos in one sitting. Please enlighten us by putting more useful videos.

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

    Summary on concurency:
    1. SynchronizedHashMap:
    - decorator pattern: decorates with synchronization on all public apis
    2. ConcurrentHashMap:
    - only put() is synchronized, that too segment wise. So multiple writes can happen if on different segments By default 16 segment s are present, so 16 threads can write at the same time without locking each other.
    - thus, no atomicity between get() and put(). You will have to synchronize yourself if your put() depends on get() value.
    - AtomicInteger/Long.getAndIncrement() is an alternate for maintaining atomicity between get() and put().

  • @surindersokhal7135
    @surindersokhal7135 7 ปีที่แล้ว

    Hi Ranjith Ramachandran,
    All your videos are very well explained. I have few points to make for concurrent modification exceptions. It is not the modification(put, remove methods of hashmap) that throws the ConcurrentModificationException but iterator.next() actually throws it. Moreover updating the already existing keys does not throw any ConcurrentModificationException.
    Please correct me, if I am wrong.
    Regards,
    Surinder Sokhal

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

    Hi Ranjith, can you upload more videos on concurrency. Everyone is counting on you. Your concepts are clear and explained to the point.

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

    Thank you ranjith for posting with examples which help u me to remember for ever,,,,keep posting such contents,,👍

  • @JitendraKumar-lt8fl
    @JitendraKumar-lt8fl 6 ปีที่แล้ว

    Awesome concept of ConcurrentHashMap and ConcurrentSkipListMap

  • @headlesshorseman17
    @headlesshorseman17 7 ปีที่แล้ว

    Very good video, also you speak very clearly which in my opinion gives you a very big edge over most tutorials out there on youtube.
    Keep up the good work!

  • @bikashrajguru
    @bikashrajguru 8 ปีที่แล้ว +6

    Thanks a lot Sir :) Awesome tutorial
    By any chance can u share the ppt u used for explaining them.

  • @jayantasen23
    @jayantasen23 7 ปีที่แล้ว

    Hi Ranjith,
    Your explanations were very fine. I had one request. Could you please put up a recording about the internal working of CHM code wise in more detail. Like the details about how the CHM is actually working, its internal implementations.

  • @naveen146114
    @naveen146114 7 ปีที่แล้ว

    Hi Ranjith ramachandran,I have seen all your videos they are outstanding, eagerly looking for more videos on threads and other concepts

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

    Thank you sir for giving so many good contents

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

    Excellent video. Thanks a lot

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

    Awesome ! Simply Great ! Excellent Explanation ! Thank You so Much !

  • @narendra9903
    @narendra9903 6 ปีที่แล้ว

    Superb explanation...Have s doubt on why concurrenthashmap does not allow null key?You said values can change between api calls?What do you mean by this?You mean keys of map will change after calling methods.please clarify.

  • @bhushanbhange7065
    @bhushanbhange7065 7 ปีที่แล้ว

    @Ranjith ramachandran Looking forward for Advanced multi threading ! Watching your videos one would realize "Any thing is simple if you know it thoroughly "

  • @hagerelmahjoub1274
    @hagerelmahjoub1274 9 ปีที่แล้ว

    Hi Ranjith,
    I really liked this video, the explanations are clear, even the examples....
    I would like to know if you have a video that explains references types in java ( Strong, Soft, Weak and phantom) with examples.
    Thanks again and really good video
    Hager

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

    Didn't get bore in learning although its of around 42 mins.Thanks for explaining with good examples.

  • @swapnilredekar1321
    @swapnilredekar1321 7 ปีที่แล้ว

    Hi Ranjith, Ur video was interesting. Please explain the difference between Collections.synchronizedMap() and hashtable.

  • @rahulabrol2211
    @rahulabrol2211 5 ปีที่แล้ว

    very well explained. Please keep this good work.

  • @balajilinked2527
    @balajilinked2527 7 ปีที่แล้ว

    Your videos are really interesting and indepth. Thanks and keep the good work going. Waiting eagerly for your next videos.

  • @javahashmap9667
    @javahashmap9667 7 ปีที่แล้ว

    You are a great tutor and videos are worth watching. Simply great..!

  • @ramachandransankaran2842
    @ramachandransankaran2842 8 ปีที่แล้ว

    Splendid explanation Ranjith.. what feature in EnumMap makes it fail safe?

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

    Nice video which explain Map data structure in Java

  • @terminator8601
    @terminator8601 5 ปีที่แล้ว

    Ur style is amazing with gr8 knowledge

  • @nirajosh
    @nirajosh 8 ปีที่แล้ว

    Hi Ravi,
    Its really great content to have a quick tour of all kind of map.
    It will be beautiful if you can able to prepare some on internals working of ConcurrentSkipListMap similarly where you had nicely documented for HashMap.

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

    Hey Ranjith...your videos are topnotch...keep them coming :) Thanks!

  • @isapir
    @isapir 8 ปีที่แล้ว

    Excellent tutorial, thanks! It would be great if you could make more tutorials like this. I would personally love to see one about ThreadLocal. Thank you.

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

    Best of the best! It is the most details and premium content I could say!

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

    Kudos!! I love this tutorial. Please upload everything in a series.

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

    Make more videos please your all unique video

  • @ashishkinger8592
    @ashishkinger8592 8 ปีที่แล้ว

    Thanks a lot for explaining the maps in details. Waiting for your video on multi threadings.

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

    Super teaching man !!

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

    it would have been great if you showed a working example of each Map with expected arguments etc , the explanation for treeMap on how the keys nodes are added was not clear , are they sorted and added or are they added and then the map autosorts them as a part of the push

  • @anupamwin
    @anupamwin 7 ปีที่แล้ว

    Very well explained with examples.Thanks...

  • @prakashkchauhannn
    @prakashkchauhannn 6 ปีที่แล้ว

    Easy to understand and really very Good Explaining. Thanks.

  • @sankar0446
    @sankar0446 5 ปีที่แล้ว

    Useful great explanation sir thank u

  • @shuklabhanuprakash
    @shuklabhanuprakash 6 ปีที่แล้ว

    Please make videos on concurrency. You make one of the videos with real world examples and simplest explanation.God bless you.

  • @rohitnarang007
    @rohitnarang007 8 ปีที่แล้ว +4

    All your videos are worth watching and very nicely explained.
    I have a little problem in checking the ConcurrentHashMapExample when you executed the script from command line and running the program infinitely, how can i do in Windows. I have compiled the class and is running successfully. How can i run using script. Can you please explain.

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

      +rohit narang , it seems that from IDEs it runs OK, again it is a matter of chance. So, what I did is I wrote a shell script(being on mac) that will keep on calling java ConcurrentHashMapExample in an infinite loop, so you can observe a lot of execution results in the console. What OS are you using? If any of the Unix flavors, try a script like : while true do java ConcurrentHashMapExample done (with proper punctuations of course) will do the trick.

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

      +Ranjith ramachandran Thank you for your prompt response. Actually while is not working in a .bat file(in Windows) . So i make use of goto in batch file. Batch file is like (@echo off
      :point
      java ConcurrentHashMapExample
      pause
      goto point)
      and it does the trick :).

  • @deepaksrinivas1783
    @deepaksrinivas1783 6 ปีที่แล้ว

    Great tutorial! Excellent explanation! Please keep uploading more videos!!

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

    When are you uploading more videos?
    Really looking forward to more videos like this.

  • @dhanyakumargonageri4259
    @dhanyakumargonageri4259 5 ปีที่แล้ว

    nice explanation.......

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

    Thanks so much for sharing your knowledge!!

  • @AdarshKhare12
    @AdarshKhare12 9 ปีที่แล้ว

    Nice videos. Is it possible for you to share the lecture slides?

  • @snair1986
    @snair1986 8 ปีที่แล้ว

    Nice explanation Ranjith. Helps in better understanding.Just a small rectification, its "Hashtable" and not "HashTable".

  • @rpy1234
    @rpy1234 6 ปีที่แล้ว

    Smoothly done..Understood everything about Map

  • @vineetha1983
    @vineetha1983 8 ปีที่แล้ว

    Hi Ranjit,
    Excelllent videos.Stumbled upon them only now.
    I did not understand the syntax used in the ExecutorService.submit ().Usually this will take "runnable" or "callable" .
    I could not understand how the static method "process" is being used.
    Thanks
    Vineetha

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

      +Vineetha Palath That's Java8 feature. As runnable or callable has only run() or call(), we can just provide what needs to happen inside that one-and-only one method - jvm will implicitly do the rest. Pls subscribe to the channel for further updates

  • @kattarkhiladi1118
    @kattarkhiladi1118 9 ปีที่แล้ว

    nice description , can you please give explanation on source code concurrenthashmap thanks

  • @AyushKumar-qi2qv
    @AyushKumar-qi2qv 8 ปีที่แล้ว

    Sir...Your explanations are really good. Please keep making such videos. Suggestion: Make a complete series on Java - Beginner to Advanced Levels. It would help a lot.
    Thanks a lot again.

  • @arunamuthyala29
    @arunamuthyala29 8 ปีที่แล้ว

    Very good video

  • @nirajosh
    @nirajosh 8 ปีที่แล้ว

    Hi Ravi,
    For concurrentHashMap, I have visited jdk 8 update 71. I couldn't able to see HashEntry class. Instead i saw Node class based implementation. I think HashEntry implementation was there till jdk 7.

  • @deepalisaxena8019
    @deepalisaxena8019 9 ปีที่แล้ว

    properly explained. Got alot of clarity for different versions of Map. Thanks.

  • @rahulsaini8
    @rahulsaini8 7 ปีที่แล้ว

    Very well explained. Better teacher than most of them out there. Please upload more topics.

  • @erfelipe
    @erfelipe 7 ปีที่แล้ว

    Ranjith, I need to make a crawler that has a multithreaded FIFO list to organize the liks to search. I thought about using Hashtable, but would there be some other structure better?

  • @GurdeepSabarwal
    @GurdeepSabarwal 9 ปีที่แล้ว

    good explanation ... can you share slides link in description ..thx for your time.

  • @sathishkumarbt
    @sathishkumarbt 9 ปีที่แล้ว

    Good video for me to understand the concepts..
    Question :- You mentioned "scalable concurrent concurrentNavigableMap" for concurrentskiplistmap .could you please explain "scalablity of this datastructure".
    Request:- If you have created a video on code walkthrough of these datastructure please share.

    • @ranjithramachandran5928
      @ranjithramachandran5928  9 ปีที่แล้ว

      +Sathish Kumar , ConcurrentNavigableMap is a concurrent alternative map for sortedmap. Why is it scalable ? it has very narrowed down locking, which reduces scope and duration of lock on the data structure. The longer the locking(for example synchronized iteration), less scalable the map will be. For further understanding we would need to look at implementation details. Kindly subscribe for updates.

  • @vivekr7896
    @vivekr7896 8 ปีที่แล้ว

    Hi Ranjith,
    Got good clarity regarding weakHashMap. It would have been awesome if you added an example on Identity hashmap as well by showing how the IdentityHashMap varies by using == instead of equals.
    Also could not understand the real importance of concurrent hash map if they are not able to provide data consistency in multithreaded environment.
    Also if possible please do a video on java.util.concurrent features. Thanks a lot for sharing your Knowledge.
    -Vivek

    • @ranjithramachandran5928
      @ranjithramachandran5928  8 ปีที่แล้ว

      +Vivek R Thanks! concurrent hashmap is handy when too many threads are writing at the same time while other threads are reading from it. Most of the writes and the reads are guaranteed not to be blocked. That's a big advantage in certain systems. Data is consistent with last written snapshot.
      For concurrently I am building a series, please subscribe for updates.

    • @vivekr7896
      @vivekr7896 8 ปีที่แล้ว

      Thanks - subscribed.

  • @Rambabu-vc1um
    @Rambabu-vc1um 7 ปีที่แล้ว

    very good explanation. Thank you

  • @NeerkumarOOPS
    @NeerkumarOOPS 7 ปีที่แล้ว

    Really helpful understanding the maps concepts. Appreciate your hard work you put in. Looking more such videos.

  • @anandkadam7979
    @anandkadam7979 9 ปีที่แล้ว

    Sir, on the which basis we are decided our return type to the method like primitive type ,user defined class type, interface name or primitive class name, Object?
    And What is internal implementation of return function?

    • @ranjithramachandran5928
      @ranjithramachandran5928  9 ปีที่แล้ว

      +Anand Kadam - return type is determined by your requirement. For example, return type of a math function would generally be a primitive of int or long type. But when you deal with business scenarios, you would have modeled the application with your own custom classes, and hence they will be the return type. For example. public Account getAccount() -> as there is no built in class called Account. "return" is generally a pop operation in operand stack, that will pop computed result; that you should not be worried about unless you want implement some bytecode/assembler mechanism.

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

    awesome explanation, thank you!!!!

  • @syedfazulu6505
    @syedfazulu6505 6 ปีที่แล้ว

    Thanks Ranjith for sharing knowledge to others ,This is very nice video

  • @rupsag1520
    @rupsag1520 5 ปีที่แล้ว

    Your tutorials are really helpful..Why are not u uploading new tutorial videos? Please make and upload more videos.

  • @sandipbhaumik
    @sandipbhaumik 6 ปีที่แล้ว

    Please add some more videos which will help us to acquire the knowledge.

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

    seriously perfect video, Great Job Sir :) God Bless You Always

  • @Pritam91kar
    @Pritam91kar 5 ปีที่แล้ว

    Thanks . Great Explanation .

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

    I have just one question, Why did you stop making these brilliant videos ????

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

    Why have you stopped uploading...I have learned a lot from your tutorials. Please continue uploading more stuff on java concepts. And please create playlist of all java videos...so that I can add it to my library.

  • @yeruvanag7006
    @yeruvanag7006 8 ปีที่แล้ว

    nice yar thank u

  • @alexanderzhang7593
    @alexanderzhang7593 8 ปีที่แล้ว

    thank U Ranjith, very good Job.

  • @ashishagrawal7709
    @ashishagrawal7709 7 ปีที่แล้ว

    Hi Ranjith Sir,
    Waiting for your more videos on Core java concepts and Specially for Design Patterns..Thanks

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

    Truly Masterclass...

  • @MyRuder
    @MyRuder 8 ปีที่แล้ว

    Hey Ranjit any videos on List/Sets?Please publish

  • @jstar0008
    @jstar0008 8 ปีที่แล้ว

    Great Videos!! Its like practically explaining everything whats on the book. Moreover, its a while now that I have been waiting for your Thread video. It would be great if you could also publish videos on topic like SOAP & Restful.

  • @MaheshKumar-em2yi
    @MaheshKumar-em2yi 8 ปีที่แล้ว

    Super and it's really very good video on Map interface :) Thank you very much for sharing this video.

  • @AnilKumar-pi1co
    @AnilKumar-pi1co 8 ปีที่แล้ว

    Nice Explanation...

  • @sanjayizardar2263
    @sanjayizardar2263 8 ปีที่แล้ว

    Hats off to you. Keep uploading such awesome videos.

  • @mohammedsardar3779
    @mohammedsardar3779 5 ปีที่แล้ว

    Thanks so if we plan to use ConcurrentHashMap and to maintain consistency do we need AtomicLong ???

  • @anjaligupta6510
    @anjaligupta6510 5 ปีที่แล้ว

    Nice sir 👍

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

    Great explanation Ranjit!! hope you would add more tutorials..

  • @fezm210
    @fezm210 9 ปีที่แล้ว

    liked the video especially the code examples and animation. look forward to more videos ;-)

  • @dudadoodedoodedoode
    @dudadoodedoodedoode 8 ปีที่แล้ว

    Adipoli explanation machanae! Subscribed!

  • @prasannakhilar7198
    @prasannakhilar7198 6 ปีที่แล้ว

    Please make some videos on lock apis in java

  • @nileshshinde-eb3gi
    @nileshshinde-eb3gi 10 หลายเดือนก่อน

    Why you have stopped making videos... We need more content like this in Java🙂

  • @AnkitKumarZ
    @AnkitKumarZ 8 ปีที่แล้ว

    Really good video. Look forward to more content for you.
    Thank you.

  • @jeetparmar9343
    @jeetparmar9343 8 ปีที่แล้ว

    Awesome tutorial

  • @mahalerahulm
    @mahalerahulm 8 ปีที่แล้ว

    Very nice explanation !

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

    where are you not posting new content? your videos are amazing, keep up the good work

  • @amansrivastava7025
    @amansrivastava7025 9 ปีที่แล้ว

    good job Ranjith.

  • @hyperborean72
    @hyperborean72 6 ปีที่แล้ว

    Great work
    Thanks a lot

  • @kapildevmaurya91
    @kapildevmaurya91 6 ปีที่แล้ว

    Can you please make videos on threading.