java8 new features -HashMap

HashMap: an array of linked lists + + to achieve red-black tree

Note: 1. When the list is greater than the total capacity of about 8 or 64, is converted into a red-black tree

           2. In addition to adding the slow red-black tree efficiency, other cases faster than the list

ConcurrentHashMap: now the re-entry into a locked CAS algorithm (no lock), to improve efficiency

Note: Why 1.CAS algorithm can improve efficiency? CAS is the underlying operating system supported algorithms

 

We want to see the red-black tree and CAS operators hair, please pay attention to me, they have the appropriate after a corresponding presentation

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/chenchun/p/11821399.html