Code Implementation — Segment Locking
Implement a Concurrent HashMap using segment locking in Python and Java — divide the table into independently lockable stripes for thread-safe put, get, remove, and automatic resizing with fine-grained parallelism.