public class HashMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, Cloneable, Serializable
{
/**
* The default initial capacity - MUST be a power of two.
*/
static final int DEFAULT_INITIAL_CAPACITY = 16;//默认初始容量(数组大小)
/**
* The maximum capacity, used if a higher value is implicitly specified
* by either of the constructors with arguments.
* MUST be a power of two <= 1<<30.
*/
static final int MAXIMUM_CAPACITY = 1 << 30;//1073741824最大的容量范围
/**
* The load factor used when none specified in constructor.
*/
static final float DEFAULT_LOAD_FACTOR = 0.75f;//加载因子默认0.75
/**
* The table, resized as necessary. Length MUST Always be a power of two.
*/
transient Entry[] table;//存储数据的entry数组
/**
* The number of key-value mappings contained in this map.
*/
transient int size;//数组的大小
/**
* The next size value at which to resize (capacity * load factor).
* @serial
*/
int threshold;//临界值=加载因子*初始容量(当size大于临界值就会出现数组扩充到原来2 倍)
/**
* The load factor for the hash table.
*
* @serial
*/
final float loadFactor;//加载因子默认0.75
/**
* The number of times this HashMap has been structurally modified
* Structural modifications are those that change the number of mappings in
* the HashMap or otherwise modify its internal structure (e.g.,
* rehash). This field is used to make iterators on Collection-views of
* the HashMap fail-fast. (See ConcurrentModificationException).
*/
transient volatile int modCount;//修改的次数