Hashmap concurrency issue

后端 未结 9 884
南旧
南旧 2020-11-30 01:54

I have a Hashmap that, for speed reasons, I would like to not require locking on. Will updating it and accessing it at the same time cause any issues, assuming I don\'t min

9条回答
  •  时光取名叫无心
    2020-11-30 02:27

    If by 'at the same time' you mean from multiple threads, then yes you need to lock access to it (Or use ConcurrentHashMap or similar that does the locking for you).

提交回复
热议问题