What implementation detail makes this code fail so easily?
First, it’s not failing reliably. I managed to have some runs where no exception occurred. This, however doesn’t imply that the resulting map is correct. It’s also possible that each thread witnesses its own value being successfully put, while the resulting map misses several mappings. But indeed, failing with a NullPointerException happens quite often. I …