Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaConcurrentHashMapSingle-choice MCQ

Two threads each run the loop below 1000 times against the same shared ConcurrentHashMap. What is the final value for key "c"?

// shared map, initially empty for (int i = 0; i < 1000; i++) { map.merge("c", 1, Integer::sum); }