HashMap source code interpretation and interview questions

First look at a few HashMap interview questions:

1. Please briefly describe the underlying storage data structure of HashMap?

2. How is the hash value of the key of HashMap calculated? Why is this achieved?

3. What is the default capacity of HashMap? What is the load factor? How does the capacity change? What should I do if the capacity is not enough?

4. The storage process of the underlying data of the put method called by HashMap?

5. Why choose to use red-black tree when HashMap linked list node is too deep?

6. What is a red-black tree, talk about your understanding of the red-black tree?

7. What is a hash collision, and what to do if a hash collision occurs?

8. What is the difference between JDK1.7 and JDK1.8 HashMap?

9. What is the difference between HashMap and HashTable?

10. What is the difference between HashMap and ConcurrentHashMap?

11. Can we make HashMap synchronized (thread safe)?

12. How does HashMap implement sorting

Later, I will take time to improve the interpretation of the source code...

Guess you like

Origin blog.csdn.net/qq_34050399/article/details/107373184