Saturday 27 August 2016

Behaviour of ConcurrentHashMap when it has Duplicate key.

Behaviour of ConcurrentHashMap when it has Duplicate key.

ConcurrentHashMap will overwrite previous value for a given key in Map. The object whos reference is lost are eligible for garage collection.

public class VoiceConcurrentHashMap {

public static void main(String[] args) {

ConcurrentHashMap<String,String> map = new ConcurrentHashMap<String, String>();
System.out.println(map);
map.put("Lnkedin", "profile");
map.put("Lnkedin", "profile");
map.put("Lnkedin", "jagdeesh");

}
}

ref :
1. Java API
2. Stackoverflow


1 comment:

  1. Casino Slots App | $1,000 Deposit Bonus - JtmHub
    Casino Slots is an online 계룡 출장마사지 casino that offers its players casino-inspired experience for users 문경 출장샵 to test out their favorite 파주 출장안마 casino 광주광역 출장마사지 games, online poker, and more. Rating: 경주 출장샵 4.7 · ‎5,943 votes

    ReplyDelete