#17 - How HashTable works Internally? HashTable vs HashMap in Java - By Naveen AutomationLabs

  Рет қаралды 51,572

Naveen AutomationLabs

Naveen AutomationLabs

3 жыл бұрын

In this video, I have explained How HashTable works Internally? HashTable vs HashMap in Java.
It's a very popular interview question in Java if you are going for Java, SDET, Automation profiles.
Full Java Collection Playlist:
• Latest Java Collection...
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
kzbin.info%20Au...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/COJqZUPB02r5sB7...
Paid courses (Recorded) videos:
naveenautomationlabs.com/reco...
For Java & Selenium - naveenautomationlabs.com/selen...
For API (Manual + Automation) - naveenautomationlabs.com/manua...

Пікірлер: 81
@kavinithees2696
@kavinithees2696 3 жыл бұрын
World's best explanation 👌💯 highlight is you have explained with the debugger mode no one will explain like this. While I'm writing the codes and debugging expanded the hashtable there is an lot of nulls available but now I got to know thes reason. Thanks for your explanation 👍
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Glad that you liked it 🙂
@shashankjain9704
@shashankjain9704 Жыл бұрын
Thank you so much for this video. I was studying this topic for many days. Now, finally the internal working got cleared.
@kumarnavit9355
@kumarnavit9355 2 жыл бұрын
Best of all the explanations available over youtube
@dushyag3303
@dushyag3303 3 жыл бұрын
Clear explanation.. looked at several sites never understand this clearly Thank you 🙏
@amitbhattacharya356
@amitbhattacharya356 2 жыл бұрын
Flawless explanation. Thanks for this video, I liked the way how you have shown with debugger mode on. I am lucky that youtube has suggested me this video.
@arvindhr.a2315
@arvindhr.a2315 3 жыл бұрын
First time watching a video with such an explanation, Excellently explained sir ! Thanks Much.
@seekersofwisdom85
@seekersofwisdom85 Жыл бұрын
Its a very good video. I was searching for a good one. Finally. Thanks Man.
@varunbe09
@varunbe09 2 жыл бұрын
Very well explained . Today I attended interview for amazon austin location senior software engineer, and they asked me this question.
@chetanchoudhary08
@chetanchoudhary08 2 жыл бұрын
The main thing to explain here was how hashset avoids null keys and how it is synchronized. Other than that it was good
@user-tr6hy8pr5v
@user-tr6hy8pr5v 5 ай бұрын
Wonderful explanation..Thank you so much. Please provide more video's which will be very helpful
@navdeepupadhyay5984
@navdeepupadhyay5984 3 жыл бұрын
Thanks, Naveen for the deep explanation.
@sagar1691
@sagar1691 Жыл бұрын
Brilliant , Wish every technical topic in any stream have these kind of videos to explain in details... Looking forward to more videos like these.
@naveenautomationlabs
@naveenautomationlabs Жыл бұрын
Glad you liked it
@bishalkumarmohanty3782
@bishalkumarmohanty3782 3 жыл бұрын
Important for Interview..Exceptional
@ajitbombe5168
@ajitbombe5168 3 жыл бұрын
Perfect explanation ! thank you :)
@vinaysharma530
@vinaysharma530 3 жыл бұрын
Okay sir thank you Your explanation is very good👌
@akshaysharma2841
@akshaysharma2841 3 жыл бұрын
great video. I watched your video on internal working of hastable as well . Seeing the video above, is it safe to say that internally both hashtable and hashmap work similarly with regards to collision as the data entry depends on the hashcode generated and the index being calculated? Would appreciate if you can clear my doubt.
@velanc902
@velanc902 3 жыл бұрын
Nice one Naveen.Thanks for this video. Waiting for more :).
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
more videos will be there. I'll make you guys perfect in Java Collections.
@letmehink166
@letmehink166 3 жыл бұрын
Great videos..In the interviews for the testing automation profile, will they also ask to write the code to show internal working of hashtable or hashmap, or just the concept explaination? Pls reply
@shruthishru3553
@shruthishru3553 Жыл бұрын
wonderfully explained..thanks a lot :)
@ramyaraja9411
@ramyaraja9411 3 жыл бұрын
Thanks for this video Naveen.. Well explained..
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
My pleasure
@PrakashPradhan-lo4cv
@PrakashPradhan-lo4cv Жыл бұрын
wonderful explanation👌👌
@syedjami4033
@syedjami4033 2 жыл бұрын
best explanation on the internet
@moulikavankam
@moulikavankam Жыл бұрын
Hi Naveen, Your videos are too good even for beginners. I have a doubt. In get method, will it use hashcode method or equals method to validate the key? Please clarify.
@rsundar81
@rsundar81 3 жыл бұрын
Good Explaination.. Keep going..
@ahmadreza7508
@ahmadreza7508 2 жыл бұрын
Thank you so much for this video
@yadneshtakalkar275
@yadneshtakalkar275 3 жыл бұрын
beautifully explained
@praveenkumaer4502
@praveenkumaer4502 Жыл бұрын
Excellent explanation
@vinayakthorat7231
@vinayakthorat7231 2 жыл бұрын
Thanks Naveen!
@shriramnirmal5535
@shriramnirmal5535 3 жыл бұрын
Very helpful video, I have a small confusion , can hash code be same for two different key values , because even in collision while using get method on same index the hash codes seems different , I am bit confused with the same hash code problem , can you please clarify it
@anupamasingh7366
@anupamasingh7366 3 жыл бұрын
Hi Naveen, do we have threshold value restriction in HashTable also like hashMap ?
@sn2dk1
@sn2dk1 2 жыл бұрын
Thank you so much
@akashsingsarva7110
@akashsingsarva7110 3 жыл бұрын
Nice work bro.
@rajeshyadav-cw6vc
@rajeshyadav-cw6vc Жыл бұрын
Thank you sir👌🙏
@karthickg9931
@karthickg9931 2 жыл бұрын
HI Naveen, Once the threshold is reached the linked list of Hashmap will be converted in to balanced binary tree similarly in Hashtable what is the threshold value and will it change to binary tree here as well, once the threshold is reached? Please clarify on this part. Thanks in advance :-)
@socialmedia434
@socialmedia434 3 жыл бұрын
Hi Naveen, Can 2 keys have the same Hashcode? When they have the same index collision occurs. What happens when they have the same Hashcode. also @18:58 when you said peter and Naveen have same Hashcode did u mean they have same index?
@afrozalam9857
@afrozalam9857 2 жыл бұрын
Hi Naveen, In case of internal implementation of Hashtable and HashMap, is there any difference?
@nikhiltiwari975
@nikhiltiwari975 3 жыл бұрын
good one , sir :)
@subhashreesahoo2233
@subhashreesahoo2233 3 жыл бұрын
Thanks... So important..
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Glad that you liked it.
@testinginsights-muktasharma
@testinginsights-muktasharma 3 жыл бұрын
Hi, can you please check the links in the description box? Looks like those are not working. Please let me know once you update it. I am more interested in knowing api(manual&automation)link please. Thank you!
@xoda345
@xoda345 Жыл бұрын
Hi Naveen, between 18.03 to 18.12 you said that in case of collision, hashCode is same but there is no guarantee that it will be same. It can be same or different. Instead of hashCode shouldn't it be index like index should be same during collision?
@shaleensudhakar8383
@shaleensudhakar8383 3 жыл бұрын
From Java 8 prospective there is change in the working of hash collision. in worst case scenario if all keys generating same hash code then the performance is decreased from O(1) to O(n). to solve this Java 8 replaces linked list(storing same hashcode keys) to binary tree when certain threshold increases.
@krishanuchakraborty3500
@krishanuchakraborty3500 3 жыл бұрын
I don't understand why these beautiful videos of yours are not gaining traction as much as your Whiteboard or Selenium series...
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Most of the people want to learn just Selenium, but not actual programming concepts. That's ok, these videos will always be there for you guys to learn. It will get traction eventually.
@pratikjain1937
@pratikjain1937 3 жыл бұрын
Nice explained...
@krishanuchakraborty3500
@krishanuchakraborty3500 3 жыл бұрын
@@naveenautomationlabs Thanks for your reply, yes I am sure they will gain traction, quality content always does👍🙏
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
@@pratikjain1937 Thank you...:)
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
@@krishanuchakraborty3500 Thanks for your words. Keep sharing these videos in your network.
@RakhiDhavale
@RakhiDhavale Жыл бұрын
well explained
@blessyRelatable
@blessyRelatable 4 ай бұрын
Thanks
@jyotikoli6006
@jyotikoli6006 3 жыл бұрын
Sir hashtable and hashMap both create a linked list internally if there is any collision... So both work same???
@shashankvishwakarma959
@shashankvishwakarma959 2 жыл бұрын
i have a doubt here while performing get operation, for get("Naveen") we only comapre 'hashValue' or only comapre 'key' ... and .equals is applicable in which scenario ie: for hashValue or for key ... thanks in advance !!
@pratapjavasingh3239
@pratapjavasingh3239 3 жыл бұрын
One more doubt is related to the fail safe fail fast when my implementation collection classes like hashmap not threads safe then we caught the concurrent modification but if u are taking vector then it's threads safe again we caught the same exception when are performing read and write operation both at a time why
@gauravvarma6483
@gauravvarma6483 3 жыл бұрын
Thanks a lot, Naveen Awesome explanation. I have one doubt. Suppose index 4 has ("India",10) and next time we are trying to add ("India",20) now the same hashcode and the same index will be generated so there is collission. Since it doesn't allow duplicate "India" will have which value 10 or 20? are we using equals() here?
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Duplicate keys won't be accepted. It will take the latest value as 20 on key = india.
@gauravvarma6483
@gauravvarma6483 3 жыл бұрын
@@naveenautomationlabs got it. Thank you so much
@bogastocksstocks8366
@bogastocksstocks8366 Жыл бұрын
Can you explain same for ConcurretHashMap and SynchronizedMap. thanks in advance.
@pratapjavasingh3239
@pratapjavasingh3239 3 жыл бұрын
I have one doubt regarding the garabage collectors respect to the Hashmap so if u taking the weak Hashmap and ur reference variable as a null then garbage eligible for destroying the object as a null refrence but in same case if u taking hashmap then ur unrefrence object not eligible to garabage so here my question is that's why not dominated to respect to the Hashmap same as weakhashmap object
@socialmedia434
@socialmedia434 3 жыл бұрын
Hi Naveen @Naveen AutomationLabs can two different keys have the same hashcode. What happends in this case. Kindly explain. Thank you
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Yes it can have the same hashcode for two different keys or objects. It will calculate same index and collision will happen.
@socialmedia434
@socialmedia434 3 жыл бұрын
@@naveenautomationlabs Thanks Naveen. Also does the get() method use both hashcode() and equals(key) method to look for the key? or just equals() method to search for the key? Thank you
@conred1401
@conred1401 3 жыл бұрын
🔥🔥
@joshbenjamin1100
@joshbenjamin1100 Жыл бұрын
I'm not able to see the hash code in intelliJ the way you find it (I think you're in Eclipse); any pointers?
@bisht173
@bisht173 11 ай бұрын
What about equals method in case of collision..
@rithup2420
@rithup2420 3 жыл бұрын
I have a question here, we have inserted naveen first and then Peter. So in debug mode I see Peter is inserted first and then naveen is inserted after Peter. How is this possible and explanation pls
@DurgaShiva7574
@DurgaShiva7574 3 жыл бұрын
this is a very nice video..but please explain is there any difference in HashMap and Hashtable classes apart from versions of java in which they were included(as the internal working of both of them seems to be same) ..if yes..please explain...also please tell WHY Hashtable doesn't allow even 1 null key (or value as well),, whereas the hashmap does...????...can anybody please answer to these questions...thanks in advance
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Refer this video: kzbin.info/www/bejne/iYnJpHV6idSXprs
@rahulbotcha9456
@rahulbotcha9456 2 жыл бұрын
how did you put naveen key in the 4 index
@pratapjavasingh3239
@pratapjavasingh3239 3 жыл бұрын
One more doubt same as Hashmap why only one as null key and multiple null value alloweded and this kind of features not available in hashtable and it's possible then explained by use cases
@VikasSharma-hm6xt
@VikasSharma-hm6xt 10 ай бұрын
what is the type of that array segment?
@akki7949
@akki7949 2 жыл бұрын
It wont store hashcode like it is done in hashMap??
@akki7949
@akki7949 2 жыл бұрын
It working is same like hashmap. Only difference I found that number of bucket in hashmap is 16 and in hashtable is 11. And formula to calculate index is different.. this is the only difference? Pls reply
@arvindmd3280
@arvindmd3280 2 жыл бұрын
Yes you are right
@akki7949
@akki7949 2 жыл бұрын
@@arvindmd3280 thnxxx
@kumarjadhav6106
@kumarjadhav6106 Жыл бұрын
How to resolve hash collision..
#18 - Introduction to LinkedList || Implementation of LinkedList in Java
18:49
Naveen AutomationLabs
Рет қаралды 25 М.
La revancha 😱
00:55
Juan De Dios Pantoja 2
Рет қаралды 45 МЛН
DELETE TOXICITY = 5 LEGENDARY STARR DROPS!
02:20
Brawl Stars
Рет қаралды 16 МЛН
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 65 МЛН
#15 - Top 20 HashMap Interview Questions in Java || By Naveen AutomationLabs
27:35
HashTable vs HashMap vs Concurrent HashMap all kinds of Map implementations
41:26
How does HashMap internally works | Java Interview Questions in Hindi
17:04
Learn Code With Durgesh
Рет қаралды 90 М.
14.11 HashMap and HashTable in Java
8:44
Telusko
Рет қаралды 666 М.
Map and HashMap in Java - Full Tutorial
10:10
Coding with John
Рет қаралды 536 М.
i like you subscriber ♥️♥️ #trending #iphone #apple #iphonefold
0:14
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 719 М.
Mem VPN - в Apple Store
0:30
AndroHack
Рет қаралды 96 М.
Мечта Каждого Геймера
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,3 МЛН