The video introduces the content of HashMap through the following four aspects
First, what is HashMap
A hash hash converts an arbitrary length into a fixed value by an algorithm (the hash function algorithm). Map: x, y Storage Summary: The value of the hash, then the value to the map, then the value stored in the map of the hashmap rationale
1. Can the KEY be empty? Yes, null as a key to store
2, if the hash key repeated will overwrite it? Overwrites, but returns the old value
3, HashMap When do the expansion? When put, the threshold value is above or equal to 0.75, 2 of the multiplier to do the expansion.
Second, source code analysis
1. Introduction of initialization parameters
2, Put method analysis
3. Get method parsing
4, Entry Object Introduction
5. Expansion Source Analysis
Third, handwriting implementation
1. Define the interface map
2. Realizing class HashMap
Iv. deficiencies
1. Flexibility
2, time complexity: The hash algorithm determines the efficiency, the expansion of the time needed to put a hash into the new Entry table array.
Video: Java bat Large company interview must test -1.hashmap source code analysis and implementation
More information: http://myscs.top
Java bat Large company interview must test skills video -1.hashmap source analysis and implementation