To get duplicate key we use Identity HashMap with Example?
>> Tuesday, May 24, 2011
To identify duplicate keys in Identity HasMap JVM uses (==).
PROGRAM:
class DuplcateKeys{
IdentityHashMap ihm=new IdentityHashMap();
ihm.put("10", "BHaskar");
ihm.put("10","Ajantha");
System.out.println(ihm);
{10 : Bhaskar, 10:Ajantha}
PROGRAM:
class DuplcateKeys{
IdentityHashMap ihm=new IdentityHashMap();
ihm.put("10", "BHaskar");
ihm.put("10","Ajantha");
System.out.println(ihm);
}
OUTPUT:{10 : Bhaskar, 10:Ajantha}
0 comments:
Post a Comment