# ConcurrentHashMap
`HashMap` `*`
`ConcurrentHashMap`
##

`Segment` `HashEntry` `HashMap`
`ConcurrentHashMap` `Segment` `ReentrantLock` `HashTable` `put` `get` ConcurrentHashMap `CurrencyLevel` (Segment ) `Segment` `Segment`
## get
`ConcurrentHashMap` `get`
`Key` `Hash` `Segment` `Hash` `HashEntry` `value` `volatile` ([volatile ](https://github.com/crossoverJie/Java-Interview/blob/master/MD/Threadcore.md#%E5%8F%AF%E8%A7%81%E6%80%A7))
## put
`HashEntry`
```java
static final class HashEntry {
final int hash;
final K key;
volatile V value;
volatile HashEntry next;
HashEntry(int hash, K key, V value, HashEntry next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
}
```
HashEntry value `volatile` put
Key Hash Segment put HashMap HashMap ()
ConcurrentHashMap
## size
`Segment` `volatile` `count` , `ConcurrentHashMap` `size` `count` `volatile`
`size` `count` `count` `size`
`ConcurrentHashMap` `Segment` `modCount` `put remove` `modCount` +1 `modCount`