This question evaluates a candidate's understanding of Java concurrency, thread-safety of collection implementations, and performance trade-offs in hash-based maps, testing skills in multi-threading, data structures, and concurrent programming within the Coding & Algorithms domain.
Is Java's HashMap thread-safe? Explain why or why not. How does ConcurrentHashMap achieve thread safety and performance (e.g., lock striping, CAS operations, non-blocking reads, tree bins under high collisions, resizing strategy) in modern JDKs? Discuss typical pitfalls and when to prefer each.