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