It 18 Palm Job _java Foundation 12th Day _ Collection

Source: Internet
Author: User

1. Describe the HASHMAP internal implementation principle.

2. Describe the difference between hashset and HashMap.

3. The collection of grades uses a nested implementation of map.

Class 10, 50 people per class.

4. Programming to achieve copy of text files. The reasonable design procedure, obtains the buffer area the size high efficiency interval.

The prompt buffer setting starts at 1k and does not exceed 10M.

------------------------------------------------------------------------------

1 HashMap from portrait to include a hashset type of key set, a collection value set. The nature of HashMap is a entry HashSet collection. In the storage mode, a hashing algorithm is implemented hashmap the bottom layer, and the hash is a search algorithm based on keyword, which improves the HASHMAP's searching speed. HashMap's lookup mechanism is to first use the object's hashcode to derive an address using equals to compare the various elements of the linked list in the address if the corresponding value is taken out. The implementation mechanism of the hash is that the Hashcode method of overriding the object, the Hashcode algorithm of object is implemented by the operating system, and Java gives the implementation of the hashcode algorithm of string (result*31 overlay). Java is based on the hashcode with the return value >>>16 and hashcode or the lower 16 bits more scattered. Assign address to object[].

2,hashset does not have the concept of kv pairs, the bottom layer is implemented by HashMap

3,map<integer,map<integer,string>> school= New Hashmap<integer,map<integer,string>> ();
        
        for (int i=1;i<=10;i++) {
            Map<Integer,String> classes=new Hashmap<integer, String> ();
            for (int j=1;j<=50;j++) {
                 classes.put (J, i+j+ "");
            }
            school.put (i, classes);
            
        }

4,filereader reader=new FileReader ("D:/a.txt");
Char[] Buffer=new char[1024];
FileWriter writer=new FileWriter ("D:/b.txt");
int length=-1;
while ((Length=reader.read (buffer))!=-1) {
Writer.write (buffer, 0, length);
}



It 18 Palm Job _java Foundation 12th Day _ Collection

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.