The collection class in the
Java.util contains some of the most commonly used classes in Java. The most commonly used collection classes are List and Map. The specific implementations of list include ArrayList and vectors, which are variable size lists that are more suitable for building, storing, and manipulating any type of object element list. The List applies to situations where an element is accessed by a numeric index. The
Map provides a more general method of element storage. The Map collection class is used to store element pairs (called "Keys" and "values"), where each key maps to a value. Conceptually, you can view the List as a Map with numeric keys. In fact, there is no direct link between the List and Map, except for the definitions of Java.util and Chinese. This article focuses on the map included in the core Java release suite, and also describes how to adopt or implement a dedicated map that is more appropriate for your application-specific data.
After understanding the map in Java, directly on the code!
Run Effect chart:
The above is the entire content of this article, I hope to help you learn.