tag:blogger.com,1999:blog-694855878384792308.post4545729862003998075..comments2024-03-21T06:26:49.387-07:00Comments on Java67: How get() and put() methods of HashMap works in Java? [Explained]javin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-694855878384792308.post-9480612823682901272021-06-22T07:41:57.930-07:002021-06-22T07:41:57.930-07:00can someone tell me how collisions are handled in ...can someone tell me how collisions are handled in LinkedHashMapA.Bharath kumar reddyhttps://www.blogger.com/profile/03632202133164279666noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-31776748895985117292018-10-26T05:33:04.150-07:002018-10-26T05:33:04.150-07:00you mean Map? it return null.
As per Javadoc
get ...you mean Map? it return null. <br />As per Javadoc<br />get returns the value to which the specified key is mapped, or null if this map contains no mapping for the keyjavin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-46403511933694669182018-10-25T22:47:52.175-07:002018-10-25T22:47:52.175-07:00Hi to All.
What happens if i pass a key on a get()...Hi to All.<br />What happens if i pass a key on a get() which is not available in keySet.<br />Anonymoushttps://www.blogger.com/profile/14423697990353434603noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-90169878885267245202018-08-31T06:08:37.515-07:002018-08-31T06:08:37.515-07:00After getting hash code of key it will convert it ...After getting hash code of key it will convert it as an integer value(range would be with in size) by calling hash(). Anonymoushttps://www.blogger.com/profile/04827213923912408959noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-1077203589029147892018-05-12T02:01:20.732-07:002018-05-12T02:01:20.732-07:00The way it fetches the array location or index is ...The way it fetches the array location or index is using a bitwise operator to compare the key with hashcode, it doesn't directly uses the hashcode to store value.Unknownhttps://www.blogger.com/profile/04629643750722238439noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-48311438576188836562018-04-10T05:26:39.818-07:002018-04-10T05:26:39.818-07:00hi,hashMap find the exact index from bucket for ke...hi,hashMap find the exact index from bucket for key value pair from hashCode but its not true, Suppose HashCode is 16000 means hashMap store the data at that location, How come its possible as hashMap can not so much in size?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-77980564331885512792017-11-22T11:58:51.203-08:002017-11-22T11:58:51.203-08:00Good for fresher as well experienced..Good for fresher as well experienced..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-34366206195620286412017-02-24T07:27:19.040-08:002017-02-24T07:27:19.040-08:00Simple and upto the point explanation.Thanks for s...Simple and upto the point explanation.Thanks for sharing Asrahttps://www.blogger.com/profile/04035024454682067339noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-77625476552146910942016-10-09T22:01:17.678-07:002016-10-09T22:01:17.678-07:00Learned lot thank uLearned lot thank uGeorgehttps://www.blogger.com/profile/18179211477357997339noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-43781418128765146732015-10-19T02:14:23.389-07:002015-10-19T02:14:23.389-07:00It was Good Learning, Thanks
It was Good Learning, Thanks<br />Demo Bloghttps://www.blogger.com/profile/13241913006658356301noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-28333263855675950632015-05-25T05:15:36.236-07:002015-05-25T05:15:36.236-07:00Wow. nice article .
Thank you.Wow. nice article .<br />Thank you.kartik kudadahttps://www.blogger.com/profile/08086600138252617955noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-71731021709339267742015-05-24T10:32:31.257-07:002015-05-24T10:32:31.257-07:00I think its just O(logN) and not O(nLogN), because...I think its just O(logN) and not O(nLogN), because you are right O(NLogn) is worse than O(n) in terms of performance. Javinnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-6282853857335556752015-05-14T02:07:23.017-07:002015-05-14T02:07:23.017-07:00O(n) to O(nLogN) ?? isn't O(nLogN) worse than ...O(n) to O(nLogN) ?? isn't O(nLogN) worse than O(n)?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-86889494578655402352014-12-15T20:34:58.551-08:002014-12-15T20:34:58.551-08:00From Java 8 onwards, working of get() method has c...From Java 8 onwards, working of get() method has changed little bit. Now if number of elements in a bucket linked list grows beyond a thresold, it will automatically be converted into a tree structure. This will reduce worst case performance of get() call from O(n) to O(nLogN), which is quite a significant perofrmance improvement. Shobhitnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-42912755194684208482013-07-15T19:30:02.129-07:002013-07-15T19:30:02.129-07:00Most difficult part of understanding internal work...Most difficult part of understanding internal working of HashMap is re-sizing of internal array. I know that when re-sizing happens, entries from old array is copied into new array, but I am more worried about how linked list in a certain index is copied. Anyone can please explains that point.. , thanks.Anonymousnoreply@blogger.com