"Writing High-quality code: 151 recommendations for improving Java programs" notes

Source: Internet
Author: User
Tags object serialization try catch google guava

To fight the unthinkable,you has to is willing to do the unthinkable. Do not use the try catch in the loop, it should be placed outside the loop.

One line

Be sure to leave the value of the constant unchanged during operation. Ensure that the two operation types in the ternary operator are identical. The construction method does not execute when deserializing. In a serialization class, you do not use a construction method to assign a value to the final variable. Avoid complex assignments for final variables. When publishing an application, the use of class file substitution is prohibited, and the overall war package release is Surefire plan. A null value check is done when the wrapper type participates in the operation. Generating wrapper instances from the valueof of the wrapper class can significantly improve spatial and temporal performance. Priority use of basic type variables to be declared after use do not overwrite the static method multiple inheritance can be implemented with internal classes. equals should consider a null value scenario Apache Commons.jar Tostringbuilder class is recommended to use string direct value assignment If the sort is not a key algorithm, use the Collator class. Beware of shallow copies of arrays specify the initial capacity for the collection in a definite case. The primitive type can not be used as the input parameter of aslist, otherwise it will cause the program logic confusion. Frequent insertions and deletions use LinkedList TreeSet to sort the collection data for invariants, such as String, Integer, and so on, but not for variable ordering, especially for data sets that do not determine when the element will change.thread priority uses only three levels.  Google Guava JodaJava Object Serialization FrameworkKryo, or Protostuff

"Writing High-quality code: 151 recommendations for improving Java programs" notes

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.