Each segment has multiple entries. Each entry, it starts with a LinkedList. When it has too many, it changes to Black-Red-Tree.
When write, if two writes are for different segment, then it allows. When multiple writes to same segment, it uses CAS(compare-and-set) to write and handle conflict.
Each operation on segment has a counter. The counter only increases. When resize, it will get the counter first. Then it does resize. After resize, compare if the counter changes. If no change, then resize done, if not will do it again. If still fails, it tries to acquire lock on each segment.