In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.