Pergunta de entrevista da empresa Spartez

Concurrency problems with HashMap

Resposta da entrevista

Sigiloso

4 de jan. de 2019

What could happen when adding a value to the hash map: this can cause a rehash of the table, and if that occurs while another thread is iterating over a collision list (a hash table "bucket"), that thread could erroneously fail to find a key that exists in the map. HashMap is explicitly unsafe for concurrent use. Use ConcurrentHashMap instead.