In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use Map". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Map.
Architecture of Map
Map is a mapping interface. Unlike List and Set, it does not inherit from the Collection interface. The content stored in Map is key-value pairs (key-value).
AbstractMap is an abstract class that inherits from Map and implements most of the API in Map. Other Map implementation classes can reduce duplicate coding by inheriting from AbstractMap.
SortedMap is an interface that inherits from Map. The content in SortedMap is the key-value pair of the sort, which is sorted through the Comparator.
NavigableMap is an interface that inherits from SortedMap. Compared with SortedMap,NavigableMap, there are a series of navigation methods, such as "get key-value pairs greater than / equal to an object", "get key-value pairs less than / equal to an object" and so on.
The main implementation classes of Map are HashMap, LinkedHashMap, TreeMap, HashTable and so on.
HashMap
Inherit from AbstractMap
Save unordered key-value pairs
Non-thread-safe, the element can be null
LinkedHashMap
Inherit from HashMap
Save ordered key-value pairs, which provide the order in which they are inserted by default, and can also be constructed to create the access order.
Non-thread safe, element cannot be null
TreeMap
Inherits from AbstractMap and implements the NavigableMap interface
Save ordered key-value pairs, sort the key by default, or construct a custom sort.
Non-thread safe, element cannot be null
HashTable
But it inherits from Dictionary and also implements the Map interface
Save unordered key-value pairs
Thread-safe, the element can be null
Source code parsing of Map
Entry
Interface Entry {K getKey (); V getValue (); V setValue (V value); boolean equals (Object o); int hashCode (); public static
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.