Why concurrenthashmap is fail safe?



Why concurrenthashmap is fail safe?..

Answer / Shivendra Pal Singh

ConcurrentHashMap in Java is designed to be thread-safe, allowing multiple threads to perform operations simultaneously without causing conflicts. It achieves this by using locks and segments for internal synchronization, ensuring that no two threads access the same bucket at the same time. This makes ConcurrentHashMap a fail-fast iterator (meaning it will throw ConcurrentModificationException if its structure is modified during iteration).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is an expression tree?

1 Answers  


What is difference between array and arraylist?

1 Answers  


How can you correct these errors?

1 Answers  


What is the difference between Strings and Arrays?

1 Answers  


How to inverting a function in sort and searching?

1 Answers  


How is it possible to insert different type of elements in stack?

7 Answers   TCS,


What is Insertion sort, selection sort, bubble sort( basic differences among the functionality of the three sorts and not the exact algorithms)?

1 Answers   TCS,


why it is difficult to store linked list as an array?

1 Answers  


What does arrays tostring do?

1 Answers  


What are different types of sorting algorithms?

1 Answers  


How can I learn data structures?

1 Answers  


Briefly explain recursive algorithm?

1 Answers  


Categories