M
M
mitaichik2019-09-12 13:06:46
Java
mitaichik, 2019-09-12 13:06:46

Does it make sense to use ConncurrentHashMap instead of HashMap if it's read-only?

There is a small Map, 10 positions, it is initialized during creation, then it does not change.
It is used very often, in different threads.
Does it make sense to use ConncurrentHashMap instead of HashMap?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Romanov, 2019-09-12
@mitaichik

No. Reading does not change the state of the map in any way, so there is no need to worry about thread safety

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question