HashMap segurando chaves duplicadas

Enquanto experimentavaHashMap, Notei algo estranho.

Ran 4 threads com cada um tentando colocar (chave, valor) com chaves de 0 a 9999, valorizando uma string constante. Depois que todos os threads foram concluídos,map.size() retornou um valor maior que 10.000. Como isso aconteceu? Isso significa que o mapa contém chaves duplicadas?

Eu iterava nomap.entrySet() e constatou que a contagem de algumas chaves era realmente superior a 1. Qual valor seria retornado se eu fizesse umget() no mapa para uma dessas chaves.

Aqui está o código que eu tentei

final HashMap<String, String> vals = new HashMap<>(16_383);
Runnable task = new Runnable() {
    @Override
    public void run() {
        for (int i = 0; i < 10000; i++) {
            vals.put(""+i, Thread.currentThread().getName());
        }
    }
};
Thread thread = new Thread(task, "a");
Thread thread1 = new Thread(task, "b");
Thread thread2 = new Thread(task, "c");
Thread thread3 = new Thread(task, "d");
thread.start();
thread1.start();
thread2.start();
thread3.start();
thread.join();
thread1.join();
thread2.join();
thread3.join();
System.out.println(Thread.currentThread().getName() + "vals "+ vals.size());
System.out.println(Thread.currentThread().getName() + "vals "+ vals.entrySet().size());
System.out.println(Thread.currentThread().getName() + "vals "+ vals.keySet().size());

questionAnswers(1)

yourAnswerToTheQuestion