I study collections, I try to summarize on HashMap & HashSet if I am in something wrong, write

I know that HashMap is just an array of Entry objects, which in turn contain two objects - a key and a value. Then the hashcode is taken from the key and according to it is determined in which index the given Entry object will lie. Each array index is a linked list, since the indexes of two Entry objects can match and then there will be several Entry objects under one index (in a linked list).

Question 1 : The hashmap is simply an array ( пусть ArrayList ) that contains linked lists ( пусть ArrayList <LinkedList> ) and they in turn consist of Entry objects ( пусть ArrayList <LinkedList <Entry >> ), right?

Question 2 : I understand that HashSet works in the same way, an array of linked lists (packets), the index is determined by the hashcode, but these linked lists (array elements) no longer contain Entry objects, but the object we placed in HashSet, right?

By the given example, do not judge strictly. I simply use simple examples to understand this concept.

  • What examples? - Roman C
  • ArrayList <LinkedList>, ArrayList <LinkedList <Entry >> i d. - Nazar Sokhan
  • Do not write the code in the comments. - Roman C

0