Java code:
Map aMap =new hashmap<string, string> (), Amap.put ("1", "A"), Amap.put ("2", "B"), Amap.put ("3", "C"); System.out.println (Amap.keyset ()); System.out.println (Amap.entryset ()); System.out.println (Amap.values ());
:
KeySet (); key collection
EntrySet (): Key-value pair
VALUES (): Value collection
Map aMap =new hashmap<string, string> (), Amap.put ("1", "A"), Amap.put ("2", "B"), Amap.put ("3", "C");//amap.clear () ;//Remove all mapping relationships map BMap =new hashmap<string, string> (); Bmap.putall (AMAP); System.out.println (Amap.containsvalue ("D"));//falsesystem.out.println (Amap.keyset ());//[1, 2, 3] System.out.println (Amap.entryset ());//[1=a, 2=b, 3=c]system.out.println (Amap.values ());//[a, B, C]amap.remove ("2") ; System.out.println (AMAP);//{1=a, 3=c}system.out.println (Amap.size ());//2amap.clear (); System.out.println (Amap.isempty ());//truesystem.out.println (BMAP);//{1=a, 2=b, 3=c}
Java Review--hashmap