27.8.2020 | 1 Minute

Fun with ConcurrentHashMap

What is the result of:

new ConcurrentHashMap(Map.of(1,2,3,4)).contains(1)

true or false?

The answer is false, not because of a strange behaviour of ConcurrentHashMap but because contains checks for values of a Map not for Keys.



Zur Übersicht

Standort Hannover

newcubator GmbH
Bödekerstraße 22
30161 Hannover

Standort Dortmund

newcubator GmbH
Westenhellweg 85-89
44137 Dortmund