1.Map1.1.the methods in map
1.2.Map.entry
For a collection, the Kye-value data is stored in the Map.entry instance, and a Map.entry instantiation object is inserted in the Map collection.
Map.entry generally used for output sets
1.3.Common subclasses of the map interface
1.4.Hashtable and HashMap differences
1.5.standard output of map (2)
Programme one:
Scenario Two:
PackageCOM.FTL;Importjava.util.Collection;ImportJava.util.Iterator;ImportJava.util.Map;ImportJava.util.Map.Entry;ImportJava.util.Set;ImportJava.util.TreeMap; Public classTest2018 { Public Static voidMain (string[] args) {Map<string, string> map =NewTreemap<>(); Map.put ("Hello", "World"); Map.put ("Hello1", "World1"); Map.put ("Hello2", "World2"); Map.put ("Hello3", "world3"); String Str= Map.get ("Hello"); Set<String> set =Map.keyset (); Collection<String> values =map.values (); Iterator<String> iterator =Set.iterator (); Iterator<String> iter =Values.iterator (); System.out.println ("\nforeach Method:"); for(String s:values) {System.out.print (s+ ","); } System.out.println ("\niterator Method:"); while(Iterator.hasnext ()) {System.out.print (Iterator.next () )+ ","); } System.out.println ("\nmap standard output _1 (map.entryset):"); Set<entry<string, string>> entryset =Map.entryset (); Iterator<map.entry<string, string>> it =Entryset.iterator (); while(It.hasnext ()) {Map.entry<string, string> next =It.next (); System.out.print (Next.getkey ()+ "-->:" + next.getvalue () + "\ n"); } System.out.println ("\nmap standard output _2 (Foreach):"); for(Map.entry<string, string>Entry:entryset) {System.out.print (Entry.getkey ()+ "-->:" + entry.getvalue () + "\ n"); } System.out.println ("Map.entryset () Size:" +map.entryset (). Size ()); }}1.6.Personnel Configuration
The study of Java-map collection