Java bat Large company interview must test skills video -1.hashmap source analysis and implementation

Source: Internet
Author: User

The video introduces the content of HashMap through the following four aspects

First, what is HashMap

A hash hash converts an arbitrary length into a fixed value by an algorithm (the hash function algorithm). Map: x, y Storage Summary: The value of the hash, then the value to the map, then the value stored in the map of the hashmap rationale

1. Can the KEY be empty? Yes, null as a key to store

2, if the hash key repeated will overwrite it? Overwrites, but returns the old value

3, HashMap When do the expansion? When put, the threshold value is above or equal to 0.75, 2 of the multiplier to do the expansion.

Second, source code analysis

1. Introduction of initialization parameters

2, Put method analysis

3. Get method parsing

4, Entry Object Introduction

5. Expansion Source Analysis

Third, handwriting implementation

1. Define the interface map

2. Realizing class HashMap

Iv. deficiencies

1. Flexibility

2, time complexity: The hash algorithm determines the efficiency, the expansion of the time needed to put a hash into the new Entry table array.

Video: Java bat Large company interview must test -1.hashmap source code analysis and implementation

More information: http://myscs.top

Java bat Large company interview must test skills video -1.hashmap source analysis and implementation

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.