In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the common HashMap iterative methods of what the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will get something after reading this common HashMap iterative method, let's take a look at it.
1. Introduction of HashMap
Introduction to HashMap: HashMap is a hash table that stores key-value pair (key-value) mappings. HashMap inherits from AbstractMap and implements Map, Cloneable, and java.io.Serializable interfaces. The implementation of HashMap is not synchronous, which means it is not thread-safe. Its key and value can all be null. In addition, the mappings in HashMap are not ordered. An instance of HashMap has two parameters that affect its performance: "initial capacity" and "load factor". Capacity is the number of buckets in the hash table, and the initial capacity is only the capacity of the hash table when it was created. The loading factor is a measure of how full a hash table can be before its capacity increases automatically. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehash (that is, the internal data structure is rebuilt), so that the hash table will have about twice the number of barrels. Typically, the default load factor is 0.75, which is a compromise between time and space costs. A high load factor reduces space overhead, but also increases query costs (as reflected in most HashMap class operations, including get and put operations). The number of entries required in the mapping and their load factors should be taken into account when setting the initial capacity to minimize the number of rehash operations. If the initial capacity is greater than the maximum number of entries divided by the load factor, the rehash operation does not occur.
Constructor of HashMap
HashMap has four constructors, as follows:
/ / default constructor. HashMap () / / the constructor HashMap (int capacity) / / specifies the constructor HashMap (int capacity, float loadFactor) of "capacity size" and "load factor" / / the constructor HashMap (Map) that contains "child size"
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.