Thread safe Hash Map?

后端 未结 3 1013
盖世英雄少女心
盖世英雄少女心 2020-12-04 11:04

I am writing an application which will return a HashMap to user. User will get reference to this MAP. On the backend, I will be running some threads which will update the Ma

3条回答
  •  被撕碎了的回忆
    2020-12-04 11:49

    ConcurrentHashMap was designed and implemented to avoid any issues with the scenarios you describe. You have nothing to worry about.

    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates.updates.

    javadoc of ConcurrentHashMap

提交回复
热议问题