#15 - Top 20 HashMap Interview Questions in Java || By Naveen AutomationLabs

  Рет қаралды 70,329

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 55
@ankeshkumar9120
@ankeshkumar9120 4 жыл бұрын
Well this is the one which was very much needed.before it started i had handful of questions,but believe me it miraculously clarified all of my doubts. Thanks a lot Naveen🙏 you deserve respect...❤️
@SarangHoley
@SarangHoley 4 жыл бұрын
Yes Naveen had earned the respect by giving very good content & with correct direction to the community, he is best always 😊👍
@bkumarj6450
@bkumarj6450 4 жыл бұрын
I am following Naveen from 10k subscribers and he helped me a lot in my automation career...now the count is growing hope it will reach to an infinite loop...
@prasadnangarale3457
@prasadnangarale3457 2 жыл бұрын
Your teaching is very very nice...realy from my heart ..thank you ,thank you, thank you...I found your channel firstly at javaMCAP course there are your vedios for collection framework... Great teaching🙏🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻💞💞💞
@kunalsinha5942
@kunalsinha5942 3 жыл бұрын
Naveen - Q no : 10 - It can store multiple duplicate values as long as keys are different..
@sureshgarine
@sureshgarine 4 жыл бұрын
This is really useful and much needed. Thanks for your service to the community.
@ABAutomationHub
@ABAutomationHub Жыл бұрын
Excellent explanation as always. Thanks for creating this video. This is very much needed!
@mysticalprodigy720
@mysticalprodigy720 3 жыл бұрын
Naveen -you are simply superb, in one word all I can say is you have solved the pain of million automation associates .
@shilpashravge5393
@shilpashravge5393 Жыл бұрын
Perfectly summarized. Appreciate your time and efforts !
@palspal2329
@palspal2329 3 жыл бұрын
Thanks sir for making such greatly needed topic wise videos
@santoshkpl2088
@santoshkpl2088 4 жыл бұрын
Thank you so much for all Hashmap videos sir and happy kannada rajyotsava..
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Same to you :)
@santoshkpl2088
@santoshkpl2088 4 жыл бұрын
@@naveenautomationlabs thanks sir
@jeyhunaliyev1765
@jeyhunaliyev1765 4 жыл бұрын
Awesome i was waiting for this Thank you very much for your help
@ishabiswas4556
@ishabiswas4556 3 жыл бұрын
Very Informative Thanks for sharing 👍 Really appreciate your efforts
@artimandale8286
@artimandale8286 8 ай бұрын
Simply amazing 👌
@jugautomation3102
@jugautomation3102 4 жыл бұрын
Great Questions Sir. Hats off.
@puneetsaneja3007
@puneetsaneja3007 3 жыл бұрын
On what basis binary tree decide what to store left and what to store on right ? Is it by hashcode value ?
@11223a3b
@11223a3b 2 жыл бұрын
Wonderful video ☺️
@minigupta6478
@minigupta6478 Жыл бұрын
Appreciated Thanks for creating this video
@dystopianNinja1289
@dystopianNinja1289 3 жыл бұрын
Amazing video. Thank you Naveen
@parulgarg7429
@parulgarg7429 3 жыл бұрын
Hi Naveen , every concept is very well explained. Can you please include this question as well and explain :->what if we don't override the hashcode() /equals() method in our custom classes. thx
@AmitKumar-qh4ow
@AmitKumar-qh4ow 3 жыл бұрын
if we will not override hashCode() method in in our custom class then default implementation of hashCode() will be called which is present in Object class, we will get a unique number for every object of custom class whether two objects contain same info like id and name are same e.g Employee emp1=new Employee(101, "Naveen"); Employee emp2(101,"Naveen"); there are two object emp1 and emp2 having same id and name, still we will get different hashCode() for every object, by using int hashCode Value1=emp1.hashCode(); System.out.println(hashCodeValue1) and using int hashCodeValue2=emp1.hashCode(); System.out.println(hashCodeValue2); we will get different hashcode value for both objects if you we will not override hashCode() method but if we will override hashCode() method based upon these two attribute id and name, we will get same hashcode value for two objects having same info (means we are putting same employee info two times) like above where id and name is same.
@hiteshdarji9925
@hiteshdarji9925 Жыл бұрын
Awsome video. One query Navin bhai what is multi threading how its performing in java and impact on hashmap value?
@sreenivasl221
@sreenivasl221 3 жыл бұрын
Very helpful your tutorials, Thank you sir!!!
@vivekkeshari6896
@vivekkeshari6896 4 жыл бұрын
🙏🙏🙏🙏 great effort in creating this ...👍👍👍👍👍👍👍👍 thanks Naveen
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
My pleasure 😊
@healthbeautytips6438
@healthbeautytips6438 3 жыл бұрын
Thanks Naveen for such a good content
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Thanks for watching
@thunikilokesh1280
@thunikilokesh1280 3 жыл бұрын
Thank you so much for the collections Why dont you try multithreading and spring boot?
@ARCHIT980
@ARCHIT980 4 жыл бұрын
Hi Naveen Thanks for the amazing video. In question 10 I have a doubt: We can store duplicate value in Java HashMap: Corresponding to different keys we can have the same values. for e.g hm.put("Archit",1) hm.put("Naveen",1)
@ARCHIT980
@ARCHIT980 4 жыл бұрын
Also in Question 21 When two keys are having the same hascode? Yes, obviously the Collison will happen. But after it will check using equals() method whether the two keys are same or not. if not same then it will create a node in the particular index of the bucket else it will override the value. @Naveen please correct me if am wrong.
@AmitKumar-qh4ow
@AmitKumar-qh4ow 3 жыл бұрын
@@ARCHIT980 you are right.
@danceayush8128
@danceayush8128 3 жыл бұрын
Great explanation 👍
@travelandspiritual
@travelandspiritual 4 жыл бұрын
Congrats for 132 K Subscribers in your channel .
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
Thank you vinod
@rajatagrawal7016
@rajatagrawal7016 4 ай бұрын
thanks a lot
@priyankabakshi9765
@priyankabakshi9765 3 жыл бұрын
Hi Naveen, Why equals and hashcode implementation is required for the key and value both if this is needed only for the key..
@AmitKumar-qh4ow
@AmitKumar-qh4ow 3 жыл бұрын
hashcode and equals methods implementation is required for key not for value.
@roopadolli1910
@roopadolli1910 3 жыл бұрын
Nice Naveen.. 🙏
@pa1gupta
@pa1gupta 3 жыл бұрын
Is threshold value 8 to convert from linkedlist to balanced tree? I see at 8 it will reorganize by increasing the size of hashmap, at 64 it will convert to tree. I see value Min_treeify = 64. Also can you explain at what threshold it will convert back to linkedlist from tree.
@harithasri8372
@harithasri8372 2 жыл бұрын
If HashMap internally uses Hashtable, then how come it is accepting null key? because hashtable do not allow nulll values. My doubt is while inserting values inside hashmap, where they will get inserted? in hashtable or at that index of hashtable new linked is created?and first element is added in that list?
@solankijigar11
@solankijigar11 3 жыл бұрын
Great job......
@ajaypaul_dancer
@ajaypaul_dancer 2 жыл бұрын
Superb
@nandhinimathivanan3998
@nandhinimathivanan3998 3 жыл бұрын
In linked hashmap collision occurs ah Naveen
@RohitSingh-br3xd
@RohitSingh-br3xd 4 жыл бұрын
Hi Naveen, what if we want to get old value for duplicate keys? Is there any way we can get old value instead of the latest?
@vijaythavva3822
@vijaythavva3822 3 жыл бұрын
When we trying to add duplicate key with same value or new value , it will override with new value. Here my question is what happens to that old value , is it stored in somewhere or is it garbage collected ? i was faced this question in an interview.
@juhiagarwal7682
@juhiagarwal7682 3 жыл бұрын
Thank you Naveen for making such informative videos. I have a confusion regarding keys returning same hashcode, if it happens how will get method return right value for corresponding key as hashcode is stored in node values to perform equals method, I think its index value which is returned same.Correct me if I am wrong.
@shankarpk89
@shankarpk89 3 жыл бұрын
hashcode = get(key) - internally the hashcode of this key is calculated then this hashcode is passed as an argument to hash function and then this hash value is passed to indexFor method which calculates the index/bucket/node. Then the equals method is invoked which checks whether the key passed matches with the key present at that particular node if the key matches then the value corresponding to the key is returned but if the key does not match which could be the case when multiple keys have the same hashcode i.e. collision case in this case at the same index we have multiple nodes in which object is stored as a linked list. So if the key does not match with the 1st key present at that node then the same operation is repeated until the key matches.
@daisyd4172
@daisyd4172 2 жыл бұрын
💛
@amritasharma5390
@amritasharma5390 4 жыл бұрын
Thank you so much 👍
@naveenautomationlabs
@naveenautomationlabs 4 жыл бұрын
You are welcome
@kumargaurav4362
@kumargaurav4362 3 жыл бұрын
Sir, could you please clear the concepts of IO ad NIO package in Java. It would be very helpful.
@nikhildsouza8905
@nikhildsouza8905 11 ай бұрын
Just FYI , Answer for 10 ) one is Yes , we can have duplicate values with different keys
@nityaranjan6714
@nityaranjan6714 Жыл бұрын
Can you sort HashMap in java? I feel answer is yes. As we can sort it according to keys or values also. Like below for sort it accordingly to keys. public class SortedHashMap { public static void main(String[] args) { HashMap hm = new HashMap(); hm.put(2, "B"); hm.put(1, "A"); hm.put(4, "D"); hm.put(3, "C"); Map sortedMap = hm.entrySet().stream().sorted((a,b) ->a.getKey().compareTo(b.getKey())).collect(Collectors.toMap(Entry::getKey, Entry::getValue,(e1,e2) ->e1)); System.out.println(sortedMap); } }
#8 - What is HashMap? How to iterate HashMap?
19:57
Naveen AutomationLabs
Рет қаралды 61 М.
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
ССЫЛКА НА ИГРУ В КОММЕНТАХ #shorts
0:36
Паша Осадчий
Рет қаралды 8 МЛН
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
01. Internal Working of HashMap & Java-8 Enhancement
19:11
Ankit Wasankar
Рет қаралды 123 М.
#11 - Different ways of creating HashMap in Java
25:00
Naveen AutomationLabs
Рет қаралды 32 М.
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 183 М.
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН