Home > Back-end >  Source code to decrypt the HashMap keySet properties?
Source code to decrypt the HashMap keySet properties?

Time:12-19

HashMap keySet attributes, it is the key in the map, but I followed two source, also didn't find out what is the time to save values? Where is the source of execution to save cost? What are the netizen to help answer?

CodePudding user response:

You have a good look at, the put method based on the hash key do find the location of the insert, and then insert the former and the position corresponding to the list of each data to compare whether to have the value, not on the tail is covered, insert (1.8 is in the tail)

CodePudding user response:

Do you have a look at the parent class

CodePudding user response:

KeySet and entrySet and values is the same, the realization of the three set does not explicitly to add value, they all inherited AbstractSet class, in fact they do not value, you look at their iterator methods in the implementation of the will know that simply means you use keySet iteration to get the value of the not keySet stored inside, but is gained from the map
  • Related