Тёмный

Equals and hashcode contract 

Ranjith ramachandran
Подписаться 40 тыс.
Просмотров 86 тыс.
50% 1

What happens when equal objects do not have equal hashcode?
The objects will cause bugs when used with hash-based collections.
All hash based operations will depend on default hashcode implementation that will return unique hashcode for each object - and hence hashmap will not be able to look up keys, hashset will allow duplicates. In this video I demonstrate this.
#java #macbookair #apple #easy #javainstitute #hashcode #handset #video #equals #javaprogramming #study #learnjava #learning #coaching #fypシ #fypシ゚viral #trending #india #fyp

Опубликовано:

 

21 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 89   
@christopherbarrett9900
@christopherbarrett9900 8 лет назад
Great example. I love when people post examples along with the theory. Good job
@amit-vg6cb
@amit-vg6cb 7 лет назад
Thanks for posting this video...I have watched many videos on the same concept , but did not get clear idea about this, now I am crystal clear on this topic. Keep posting !!
@MrThanique
@MrThanique 7 лет назад
EXCELLENT ONE. Thanks a lot for sharing
@misakyanzye4269
@misakyanzye4269 7 лет назад
Excellent explanation, clear and concise yeah! thanks
@pechorinn
@pechorinn 7 лет назад
Very nice explanation. Good job. Thank you!
@shashibhushanthakur1982
@shashibhushanthakur1982 6 лет назад
Thanks for this video related to hashCode and equal method
@rdayala14
@rdayala14 8 лет назад
Pretty neat, simple explanation!! It is always nice to see examples which explains the content. Keep it up!! Looking forward for more topics!!
@aruntcs2005
@aruntcs2005 7 лет назад
This is awesome stuff..keep up the good work
@akshoyd7735
@akshoyd7735 5 лет назад
Completely impressed with the content of videos
@praveen2hearts
@praveen2hearts 8 лет назад
Thanks for the video ... Very informative and crystal clear
@jeffsulman3558
@jeffsulman3558 6 лет назад
That was very helpful. Thank you!
@rajeshkolluju2409
@rajeshkolluju2409 6 лет назад
Nice and Simple Explanation..Thank q Sir...
@pavanscala8957
@pavanscala8957 6 лет назад
It is more helpfull to my Job interview point of view, Thank you very much, This is my first video I SUBSCRIBE Thank you
@DheerajKumarBarnwal
@DheerajKumarBarnwal 7 лет назад
Superb explanation and very helpful. Keep up the good work. :)
@liferayasif9382
@liferayasif9382 8 лет назад
Thank you so much, awesome tutorial.
@svalyavasvalyava9867
@svalyavasvalyava9867 Год назад
clear explanation, thank you!!!
@prawinaela
@prawinaela 6 лет назад
Excellent video, explained very well
@anuragbharti3773
@anuragbharti3773 3 года назад
Awesome explanation
@ranjithramachandran5928
@ranjithramachandran5928 9 лет назад
practical demonstration of mishaps that can happen if you overlook to implement a good hashcode method and expect equals to work with hash based collection. Questions/Suggestions/Criticisms? please post a comment!
@tiwarybaba
@tiwarybaba 7 лет назад
Ranjith ramachandran...no criticism, ur videos are good...u explain things very nicely. hope, u'll make some more videos on other topics. 😇
@Aditya_Valluru
@Aditya_Valluru 6 лет назад
Bit contradiction : If system generated hashcode is different for two objects which have same attributes, then how new object with same key will replace the old one. HashMap hm = new HashMap(); hm.put(1,"aditya"); hm.put(1,"adityaNew"); s.o.p(hm); prints adityaNew Can you please clarify? Also please post some more videos ... its been long time no see :)
@sinnumunnu
@sinnumunnu 5 лет назад
Amazing Explaination!!
@sachinbhadrashette3077
@sachinbhadrashette3077 8 лет назад
Thank you so much. you explained really very well so that everybody can understand. this is going to help me a lot.
@rajeshnarasimha5550
@rajeshnarasimha5550 4 года назад
thank you Ranjith, very useful information & easy to understand..
@janukhandari501
@janukhandari501 7 лет назад
Very good examples and explanation, hoping to see more videos on topics like threads, spring and more of collections. Thanks
@varungudisena9463
@varungudisena9463 10 месяцев назад
very good explanation
@janardhannallapati
@janardhannallapati 8 лет назад
Great videos Ranjith. Please keep posting them.
@AmitKumar-qh4ow
@AmitKumar-qh4ow 8 лет назад
Excellent Tutorial Ranjith. Thanks a lot.
@srividya157
@srividya157 6 лет назад
Very well explained..
@subhankarb100
@subhankarb100 7 лет назад
Thanks !!!! nice explanation...
@coach-okr
@coach-okr 8 лет назад
Thank you very much!!! I watched so many tutorials to understand that... Please, make more tutorials
@aditigoyal2622
@aditigoyal2622 9 лет назад
Thanks Ranjith!... i really appreciate this!
@rohitkarambali779
@rohitkarambali779 2 года назад
sir aap please aur topics pe bhi vdos banaye, its very helpful and knowledgeable for us, u r doing great job
@yoganandraju5539
@yoganandraju5539 6 лет назад
Awesome quality bro
@ramc7460
@ramc7460 7 лет назад
Awesome explanation I ran out of videos from your channel . We expect many videos from different concepts Great work keep going
@nitin8692
@nitin8692 6 лет назад
Nice explanation.
@vikrantkumarsmvdu
@vikrantkumarsmvdu 6 лет назад
Hi Ranjith, Videos which you have uploaded are very clear to understand. You should upload more videos on different concepts. It will be very helpful to other people.
@SuprajaYKM
@SuprajaYKM 5 лет назад
very nice explanation
@Sk-zs1cw
@Sk-zs1cw 6 лет назад
Easy to understandable and I learnt so many things about eq & hash contract. Plz make video on Thread, synchronisation and thread executor framework
@shank0877
@shank0877 8 лет назад
Great explanation Ranjith. Great job!
@anandprakash3070
@anandprakash3070 6 лет назад
Sir please upload more videos. They are really helpful for us.
@khursheedbano9046
@khursheedbano9046 8 лет назад
Good one..Plz keep posting....
@jagadishk1173
@jagadishk1173 2 года назад
Still watching your videos sir it is very useful actually.. Please make more videos..
@kranti7473
@kranti7473 6 лет назад
Pls upload more videos on different java concepts/topics.. Thanks ...
@rashimpathak8117
@rashimpathak8117 2 года назад
Beautifully explained.. do add more video on core java and new java versions
@spujain
@spujain 8 лет назад
Good explanation..
@krishnansblr
@krishnansblr 8 лет назад
Excellent video Ranjith ramachandran
@srijitpaul4149
@srijitpaul4149 7 лет назад
Nice example.
@shashisingh7565
@shashisingh7565 3 года назад
Your videos are quite helpful and you explains concept very well. Plz plz plz make videos on other java concepts like Multithreading, synchronization.
@ravinasomvanshi6844
@ravinasomvanshi6844 6 лет назад
Your videos has some different level as compare to other Java Videos..Thamk u so much.. :) ..Please do a video on Threads in Java and how to avoid dead locks
@aniketbharsakale2561
@aniketbharsakale2561 5 лет назад
Making complex look simple. would appreciate if there are more clips on other java topics as well. Thumbs Up. :)
@bhushan7546
@bhushan7546 7 лет назад
Very nice explanation Ranjit Thanks:D I serach alot on Internet for that i did't find such simple solution :D
@iCrazzyShri
@iCrazzyShri 7 лет назад
Owesome buddy, Really like your videos. I was expecting you would explain why default hashcode will make your objects unique even if it's values are same and equal method is implemented
@siddharthdg
@siddharthdg 8 лет назад
Please do a video on Threads in Java and how to avoid dead locks .
@PandeyRavindra1
@PandeyRavindra1 8 лет назад
awesome..
@dhananjaypatankar6995
@dhananjaypatankar6995 6 лет назад
Hello, nice videos. By the way, where are you these days..... Its been a while you have uploaded these videos. I see 2015 videos. Please upload new videos on Java on any concept, there is a learning curve in your videos. I guess, not only me, but many others are also waiting. Thanks.
@nirmalkumarsahoo8683
@nirmalkumarsahoo8683 7 лет назад
Thanks Ranjith ... could you please upload video which explains how serialaizable interface works
@akbarsaleem2228
@akbarsaleem2228 7 лет назад
Thanks Ranjit , it really helpful for me . But one thing i want to know that if we are not implementing hashcode method what internally happening that causes to store duplicate values and not able to get the expected name .
@rajasekar8054
@rajasekar8054 9 лет назад
thanks Ranjith !!!
@SunilKumar-tl6mv
@SunilKumar-tl6mv 7 лет назад
Nice one on equals-hashcode contract. But my doubt is does hashcode implementation depend internally on equals method? Why would hashcode give different hash values if we override equals method?
@sahilsehgal626
@sahilsehgal626 6 лет назад
Hi Ranjith, Can you please make few videos on multi threading and concurrency in java 5 ?
@lokeshreddy7755
@lokeshreddy7755 6 лет назад
please do videos on mutithreading thank u ...
@kayeshparvez
@kayeshparvez 4 года назад
this is because, we have to ensure that "For two equal objects we have to generate same hashcode"
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
sir whn u upload thread concurrency.................
@RoopkishorPandeyji
@RoopkishorPandeyji 6 лет назад
thanks Ranjith, I got 1 questions in an interview, why hashcode is required, cant only equals method do our job?, If we make our own collection classes, why java wants both equals and hashcode to compare 2 objects.
@nikjpr
@nikjpr 9 лет назад
thanks!!
@jackofnotrades15
@jackofnotrades15 2 года назад
Just to add, the key Employeekey class should also be immutable. As it is being used as key in map.
@romanlotockijj4806
@romanlotockijj4806 7 лет назад
Fine... Understood...
@bhushan7546
@bhushan7546 7 лет назад
Please upload Java 8 Feature
@swap000bhosale
@swap000bhosale 8 лет назад
I want to know why are we overriding equals method is it necessary
@ranjithramachandran5928
@ranjithramachandran5928 8 лет назад
+Swapnil Bhosale - It is necessary when you want to establish equality of your custom Objects. How would you say if your Employee e1 and Employee e2 are same? e1 == e2 check is not sufficient when you establish equality based on fields inside Employee like e1.name, e1.id, etc.
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
plz upload thread Concurrency...................reply me?
@mishikamehta4610
@mishikamehta4610 8 лет назад
Can you provide video on hashtable implementaion?
@ranjithramachandran5928
@ranjithramachandran5928 8 лет назад
+m mehta , please see ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-c3RVW3KGIIE.html
@JitendraSingh-zg3ws
@JitendraSingh-zg3ws 8 лет назад
hashset add duplicate elements because internally HashSet use HashMap
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
sir when u upload thread concurrency?
@ranjithramachandran5928
@ranjithramachandran5928 8 лет назад
+harish chowdary sure This week.
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
+Ranjith ramachandran Still u doesn't upload Thread Concurrency..............replay me sir...........
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
+Ranjith ramachandran Still u doesn't upload Thread Concurrency..............replay me sir...........
@vicky10ve
@vicky10ve 4 года назад
where are you ??? People need you!.. :)
@ashishkumarsingh1920
@ashishkumarsingh1920 6 лет назад
I am fan of your videos sir But your playlist is very limited. Please more possible video make and upload Your teaching style and knowledge in java is so high no compare to you in you tube Thanks sir
@arpanbanerjee8584
@arpanbanerjee8584 4 года назад
Why it will causs bugs..you never explained that! Examples were great. But your explanation was not in details Pls explain why it is necessary to override hashcode if we override equals method. How does that work internally if we don t do the same
@JitendraSingh-zg3ws
@JitendraSingh-zg3ws 4 года назад
may be you can check out how Hashmap works internally , there is video on this on same channel :)
@anjaliarorafan6587
@anjaliarorafan6587 5 лет назад
Not intereseted
@ashishagrawal7709
@ashishagrawal7709 8 лет назад
Thank you so much. you explained really very well so that everybody can understand. this is going to help me a lot.
@ranjithramachandran5928
@ranjithramachandran5928 8 лет назад
+ASHISH AGRAWAL Thanks!
@nishaphilip9745
@nishaphilip9745 2 года назад
Hi Ranjith, Videos which you have uploaded are very clear to understand. You should upload more videos on different concepts. It will be very helpful to other people.
@harishchowdarysure8858
@harishchowdarysure8858 8 лет назад
sir whn u upload thread concurrency.................
Далее
Камень, ножницы, нейронка
00:33
Просмотров 64 тыс.
Set and HashSet in Java - Full Tutorial
20:43
Просмотров 204 тыс.
.equals() vs. == in Java - The Real Difference
8:48
Просмотров 182 тыс.
Singleton design pattern in Java - Part 2
33:00
Просмотров 62 тыс.
Java 8 Streams API
15:45
Просмотров 153 тыс.
JVM ( java virtual machine) architecture - tutorial
29:16
#58 Object Class equals toString hashcode in Java
12:00