Map usage
Introduction to types
Java comes with a variety of Map classes, which can be classified into three types:
General Map
Used to manage mappings in applications, typically implemented in the java.util package HashMap, Hashtable, Properties, LinkedHashMap, IdentityHashMap, TreeMap, WeakHashMap, ConcurrentHashMap
Dedicated Map
Normally we don't have to create such Maps ourselves, but access them through some other class java.util.jar.Attributes, javax.print.attribute.standard.PrinterStateReasons, java.security.Provider, java.awt.RenderingHints, javax.swing.UIDefaults
Insert data
Traversing in four ways, the code is as follows:
|