How the get(Key k) method works within a HashMap|| Part 3
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- In this tutorial, we will cover how the Get method of Hashmap works.
Before watching this tutorial Please watch the part 1 of this series at the below link.
How hashmap works internally (Overview)
• How HashMap works inte...
practical of Hashmap Internals
• [PRACTICAL]How Hashmap...
subscribe to my channel by clicking on the link below.
/ @seleniumexpress
Stay tuned and like my Facebook page for more.
/ seleniumexpress
Music :
-----------
credits : -
1)
Adventures by A Himitsu / a-himitsu
Creative Commons - Attribution 3.0 Unported- CC BY 3.0
creativecommons....
Music released by Argofox • A Himitsu - Adventures...
Music provided by Audio Library • Adventures - A Himitsu...
(intro)
2)
NCM Epic Music Ender Guney
/ ncmepicmusic
-----
intro template :
wth-cam.com/users/Alexbau01
Update: From Java 8, when different keys hash to the same bucket and when the bucket capacity reaches its TREEIFY_THRESHOLD(8), the nodes in bucket will be stored in a balanced binary tree structure thereby reducing the worst case time complexity to O(log n) from O(n). When nodes in the bucket starts getting reduced and when the number of nodes in bucket reaches UNTREEIFY_THRESHOLD(6), the nodes in a bucket will again be stored in a Linked List structure.
The way of teaching is very understandable sir. Thanks for Ur valueble video. Great job.
Thanks a lot for teaching this way, I believe it makes a huge difference when you include graphical representation, thanks again!
wow... after trying so many channels, today it got cleared. Thanks buddy :) keep posting interview questions answers like this.
I saw many videos before for HashMap internal explaination, but this is the best . You explained it very well with nice and simple examples. Hope you cover moe important topics(Interview perspective topics) in future. All the best
You are awesome.Glad to know that these videos helped you.Thank you, Saravana, for posting such a lovely comment.
True !!! Completly agree
Thanks a lot for this video. 4 years doubt got cleared.
I watched lots of video but this channel is different from all. your way of teaching is very familiar thank you for sharing knowledge with us.
Very good explanation,keep it up.
I have not cleared my 2nd interview round because of this nd couple more.. But now i am much confident about this concept... Thanks
👍
I have watched several videos on TH-cam but trust me it make sense to me. Very well derived and executed. Thanks
Wow wonderful explanation 🤗
Very useful , thanks for sharing
Awesome video bro.All three videos are good
Excellent sir 👌👌👌👌👌
Thanks you so much its very crystal clear explanation .
Thank you so much for explaining clearly
Very nicely explained
Wonderful explaining skills you have, thanks for making this so easy to understand.
Your great bro love you lot ❤️❤️ keep doing more
Awesome explanation
Superb explanation
Ur reallly teaching excellently i dont know y this channel is not popular yet
Thanks Manideep..
And yes if there will be some people like you around me, who are giving some positive motivations all the time, then one day this channel will achieve it's goal 😊
Sure trainer, i will forward these video links who r reallly wants to learn kava in deep, morover ur teaching is very effective on board i could involve that i am in class
I like the way you explained and it will be more useful to everyone.You are having much talent i believe,please do more videos with good concept.
Great job🥰it was very helpful 💕💕Thank you
Thank you very much doing this video for us, it's mandatory interview question, with your explanation I will hit the interviewer like anything, good explanation and practical experience. Keep rocking🎸🎶🎶
You explained very good way n make easy this topic. Thank you shared with us your knowledge.
Nice Explanation..
Thanks for All Hash Map videos!🤝
Thank you for your efforts 🏆🏆
Thank you for clear explanation
Thanks bro. You taught hashmap very easily.
Nice explanation brother
awesome explanation,thanks buddie
Love your all videos !!🤘
Awesome hero
Very nice explanation 👍
Thank you very much🙂🙂
Awesome,very good explanation . Keep it up bro and thank
Very Nice Explanation ,i clear all my doubts Thank You So much keep it up
very nice explanation sir ,Thanks a lot for making me clear the internal working of HashMap.
Hey Crystal clear explanation yar... Thanks a lot....
very good explanation in 3 parts, thanks for creating video
well explained
awesome
Well explained...👍
Awesome explaination
Superb sir, I really felt happy seeing this video
Thanks, Mate.. You happy, I happy 😊
Ur explanation is superb, whole concept got cleared , u should kon make full course of java
Can you please make a video on how to make our own hashmap in java. (some internet contents suggest it using linked list and creating our own class). Please make a video on that as an extension to this playlist.
thanks, you explained this very well
thank you !!!! the best
Superb tutorials. Thread tutorials would be very helpful. Thanks!
Very nice and simple explanation
Great tutorial... got good amount of knowledge...Thanks
Nice
So I am going to echo the people who commented to please not call the nodes of a linked list linked lists. Nodes are individual elements. Now it is true, that sometimes, but not often, we will call nodes of a tree "Tree Nodes" but in that case it is tempting because it is only a total of two syllables and still isn't that common, we usually just say "nodes". For Linked Lists it is way, way, worse, because "Linked List Nodes" is too long and too many syllables. But the whole list itself only is called the Linked List, or perhaps some segment of it like the last five elements. Technically, any subset of a linked list could be considered a linked list, but really, the best thing to do is to only ever call the whole thing a linked list and the individual nodes just a node. If we took this example all the way and got enough collisions so that some of the buckets pointed to trees and others pointed to linked lists, there would be some excuse for calling that first reference "a linked list" because if we said node one would wonder whether we meant linked list or a tree. But even there, I would only call the first reference in each bucket a linked list (or a tree), anything linked in past that is just a node. Yes, technically the linked list is a doubly linked list, but that really doesn't change how confusing that seemed to be to some beginners. Even myself it caused me to get startled enough thinking whether you meant to say "linked list" or "node" that I had to stop the video and go back in a few different places. Overall, it is excellent, I just wanted to complain about that terminology sloppiness because I thought it detracted from the educational usefulness of the video for beginners.
Really sir it's awesome explanation.... and....also thank you so much sir@@@
Thank you Bhusan.
Can u plz upload video regarding linkedhashmap, as u explain each and every concept in detail and it is easy to understand thank u for making such videos.
Very Well Explained. I just have a one question. How will hashcode will be calculated after size of table is increased? lets say I inserted key "AAA" while size was 16 and now I'm trying to get "AAA" and current size of table is 32.
excellent explanation of hashmap
Thanks, Ram..
Code from open JDK :
if (Objects.equals(key, e.getKey()) &&
Objects.equals(value, e.getValue()))
Meaning we compare key & value in equals method to determine the uniqueness of an Object.
Awesome explanation...
love you the way u r explaining great work!
please also cover the scenario as to what happens to hashcode and their buckets when the map resizes
Very Good Explaination
Great!
superb explanation.. thanks a lot sir. very clear cut explanation. if it possible provide some data structure algorithms sessions.
Excellent sir.....
Hi Bro,
Cool bro... Thank you so much..
Cool information... Keep rocking😊👍
awesome, well explained..
Nice explanantaion Sir :)
So as you told in your previous videos that we have initially 16 bucket and to identify the bucket within that range it uses mod 16 to get appropriate bucket and when it reaches to threshold it doubles the size of bucket and according to you it uses mod 24 with hashcode to get appropriate bucket no, and here is a question " let assume that we have 13 elements in hashmap so the first 12 elements goes into the bucket by hash(hashcode%16) and remaning goes into bucket hash(hashcode%24) so at the time we call the get method what would be the hash function to select the right bucket"
awesome explanation bro
Sir ,I also need tree map internal working, Please upload vedio of tree map internal working
have u got any good video for internal working of tree map , even i am searching that
@Selenium Express Could you please add a video on how hashset works internally and how put works in hash map
nice yaar.......
Sir,
As I noticed that first you use the string object "abc" as a key to put in map after that u use the string object "abc" as a key to get the value of it.
But here I have one doubt that, as string is immutable then definitely both "abc" string object should have the different hashcode then how is this possible to get the same hashcode value again in hashmap to get the value of it
String class has overriden equal method for content comparison . Their is Contract between equals() and hashcode() in Java. If two objects even with different refrence are equal (as in your example ) , then their hashcode must be equal .
Good explanation
How it returns index 4 ? We have the hash and how to know with what should we compare it to ?
nice explanation boss
How to calculate hash code and index for a particular key and value paire
Thank you so much!
If we are comparing key using equal(), then what is the use of storing hashcode inside node. It is redundant. Please let me know
hi, in case of hash code Collison case, the hashcode value will be same, by using the equals method only we can do compare the key name and get the value from correct Node. hope it clarify the concern. thank you.
During get operation, once we calculated the index using hashcode why there is again a check for finding the target from linked list?. Obviously the hashcode for all the Nodes and the value passed to get method is same (that's how we computed the index). So cant we just check only equals() . ?
Perfect ✌🏻
As you used strings for keys, when a put method is invoked e.g. map.put("abc",1); the hash code for key "abc" will not calculate again as it calculated once when this string created, right?
awsm bro
at 4:45, why doesn't the HashMap implementation directly compare the key with the node's key using .equals()? why is it comparing the hash first, then comparing the keys with .equals() (only after it finds out that both hashes match)?
Why does it want to compare twice instead of once to find out which node is the correct one? Thank you.
Sir why cannot get method directly compare the string in first place instead of hascodes?
In a bucket there can be many objects having different hashcode, int Hashcode comparison is easy, than equals method comparison on object i feel
how to calculate index value in hashmap by using hashcode value?
Nice Video. Can you also extend this to concurrentHashmap and differences.
Bro which class equals method is going to be used here internally I mean it is of object class or string I searched alot and I found the answer as it is of object class bt obj class checks reference so plz can u tell me what is the truth m very confused 😊
I have small doubt sir, we have checked two keys using equals at the time of get method. But my question is when adding value, need check equal to(hash c collision)?
Hello sir good tutorial and explanation. How about hashtable i hope to make a video how hashtable internally works.
sir please make video on sorting hashmap on basis of kay and value Please.,
Thank you so much :)
nice explanation about put/ get operations on hashmap; Do you know recurrent modification exception problem with Hashmap?
You should rename channel I feel. Should be related to Java
I was expecting one more case here, if key is not present in HashMap
Why there is a need to store hashcode inside a node, when key is already there? Cant get(key) can be compared directly with the key present inside a node?
Swaraj Gupta, after size doubles, all the objects who are all having an be hashcodes they will be placed into same buckets i feel
please explain executor service framework
I like