Definition of Classpublic class HashMapextends AbstractMapimplements Map, Cloneable, Serializable {}belongs to the Abstractmap subclass, with properties for clone and serialization
The
implements the map interface so that HASHMAP
Java HashMap Supplements@author IxenosFragmented knowledge
Try to return to the interface instead of the actual type, such as returning list, Set, map instead of ArrayList, HashSet, HashMap, which makes it easy to change the data structure
ObjectiveIn fact, this section has been talking about the object of this universal data structure in JS. An object can be in a variety of forms, expressed as a difference between a dictionary and an array. More I think this chapter discusses more
The hash table is often used in computer programming, and in C + +, STL programming is indispensable. This article describes the use of Hash_map in STL, the method of using custom types as key values in Hash_map, and the problems encountered when
Yesterday, I saw a discussion about the set: the elements in the Set cannot be repeated. How can we tell whether the elements are repeated? Is = or equals () used ()? What are their differences? Many people give the answer: the elements in the Set
What is the difference between the MySQLHash index and the B-Tree index? I believe many people have such questions. The difference between the two is analyzed in detail below for your reference. Because of the special nature of the MysqlHash index
ConcurrentHashMap source code analysisCocurrentHashMap uses HashTable to implement concurrent hash search and storage by locking the entire table. CocurrentHashMapt can implement the same functions through Segment, but it is more efficient. In jdk1.6
Concept
1. hash
The translation is a hash, and there is also a way to name hash. We should know what we have learned about the data structure. Hash is to use the hash algorithm to obtain a fixed-length output value of any length input value. The
Analysis of common JAVA data structures and principles
Not long ago, the interviewer asked me to explain how to understand the java data structure framework. I have also read some of the source code before. balabala has talked about a bunch of ideas
Implementation principle of HashMap and HashMap
1. HashMap Overview:HashMap is a non-synchronous implementation based on the Map interface of the hash table. This implementation provides all optional ing operations and allows the use of null values
With the development of the JDK, some design defects or poor performance of the class library will inevitably be eliminated, the most common is the vector, Stack, Hashtable and enumeration.Vector (@since 1.0)First look at the vector UML class
Learn the basics of one of the most common collection types and how to optimize your map for data specific to your application.
Related downloads:· Jack's HashMap test.· Oracle JDeveloperG
The collection class in Java.util
Some understandings of HashTable:
Bottom use hash table, storage key value pair, key value non-null
Using synchronize to ensure thread safety
If multithreading is high, it is recommended to use CONCURRENTHASHMAP; If you don't need
The implementation classes for the map interface in the Java collection are HashMap, Hashtable, Linkedhashmap, and TreeMap, unlike the list where map is not inherited from the collection interface . You can understand it this way:
Map
First, why should have hash algorithmThere are two types of collections in Java , one is list, and the other is set. The elements in the list are ordered and the elements can be duplicated. The set element is unordered, but the element is not
1. The difference between HashMap and Hashtable
HashMap allows key and value to be null;
HashMap is non-synchronous, thread insecure, or Collections.synchronizedmap () method can be used to get a synchronized HashMap
HashMap faster
Storage location =hash (key)- value pair" storage location, In the structure, take the "key - value pair", according to the same hash function calculates the storage location and stores it at this location, which is called a hashing method, also
First, hash algorithmThe hashing algorithm maps a binary value of any length to a shorter fixed-length binary value, a small binary value called a hash value. A hash value is a unique and extremely compact numeric representation of a piece of data.
1. LVs Scheduling AlgorithmThere are two types of LVS scheduling algorithms: Static algorithm and dynamic algorithm.1.1. Static algorithmScheduling is based only on the algorithm itself, regardless of the actual connection and load of the backend
Originally wanted to be more comprehensive and in-depth talk about Concurrenthashmap, found online there are a lot of hashmap and concurrenthashmap analysis of the article, so this section as far as possible to analyze the details, less theoretical
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.