The underlying structure of hamap

The underlying data structure of HashMap is array + linked list; in jdk1.8 when the length of the linked list exceeds 8, the linked list will be converted to red and black
tree
Red-black tree: Red-black tree is a binary search tree that contains red and black nodes and can be automatically balanced
Property 1: Each node is either black or red.
Property 2: The root node is black.
Property 3: Each leaf node (NIL) is black.
Property 4: The two child nodes of each red node must be black.
Property 5: The path from any node to each leaf node contains the same number of black nodes

Guess you like

Origin blog.csdn.net/weixin_46729085/article/details/108318087