Training Daily 3.14 (Mysql,guava, pangolin, etc.)

Source: Internet
Author: User
Tags iterable

Guava FAQ

(1) For a fixed value range of properties, it should be defined as an enumeration type whenever possible;

(2) Iterable,collection,list,set,map are interfaces, and the relationships between them are:

List and set inherit collection,collection inherit iterable; Map belongs to a single faction, it is the topmost interface, its implementation is HASHMAP,LINKEDHASHMAP,TREEMAP, wherein the TREEMAP internal structure is a red-black tree, it stores the nodes are ordered;

Mysql

(1) MySQL single-process multi-threaded database; Orcale is multi-process;

(2) The alter operation will lock the table, causing the request to block the table;

(3) The storage engine can only be specified at the level of the table and cannot be specified at the level of the library;

(4) The MySQL field decimal (5,2) represents a total of 5 bits for the fractional and integer parts, and a decimal portion of two bits;

(5) The difference between a decimal and a float, double is that the decimal stores the precision number, which is suitable for storing money numbers, etc.;

(6) Char is fixed-length, regardless of the character, the field is 4 bytes; The varchar is long, it contains a byte to record the length of the character stored in the field, if the character length is greater than 255 with two bytes to record; therefore, "" empty string, char occupies 4 bytes, VarChar is 1 bytes, "AA" char is 4 bytes, varchar is 3 bytes, "ABCD" char is 4 bytes, varchar is 5 bytes;

(7) Text and blog are big characters, so the index can only be built prefix index;

Other

1. Always remember to judge the legitimacy of incoming parameters;

2. When judging two objects equal, try to use guava objects.equals ();

3. The sorting with top K, in addition to using the heap, priority queue, you can also use the Ordering.greatestof method in guava, using the following method:

ordering<map.entry<String,new ordering<map.entry<string,integer>> () {            @ Override            int Compare (map.entry<string,integer> left, map.entry<string,return Left.getvalue ()-right.getvalue (); } }; list<map.entry<String,integer>> topklist = Ordering.greatestof (Httpmap.entryset (), K);  

Training Daily 3.14 (Mysql,guava, pangolin, etc.)

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.