1. Final Cosmetic classthe final modified class cannot be inherited, so the member method of the final class cannot be overwritten, and the class decorated with the final keyword has no subclasses, so the implementation details of the class cannot
Code optimization Details
1, as far as possible to specify the final modifier class, methodA class with the final modifier is not derived. In the Java Core API, there are many examples of final application, such as java.lang.String, where the
To design an inheritance hierarchy at some point, you want to make sure that members are not quilt class overloaded. In Scala, as in Java, you do this by adding the final modifier to a member. For example, you could put a final modifier in front of
SOURCE | Personal Blog | Author | The Cangjie of the May
Original Address | See bottom description
This article is the author: May Cangjie The combination of his work and the experience of normal learning to reopen the reason for code optimization.
The goals of code optimization are:1, reduce the volume of the Code2, improve the efficiency of code operationCode optimization details 1, specifying the final modifier of the class and method as much as possibleA class with a final modifier is not
Code optimization, a very important topic. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about, like a
Final can be modified: attributes, methods, classes, and local variables (variables in methods)
The final modified attributes can be initialized during the compilation or runtime, but cannot be changed after initialization.
The final modifier
ObjectiveCode optimization, a very important topic. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about,
Code optimizationA very important subject. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about, like a
ObjectiveCode optimization, a very important topic. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about,
ObjectiveCode optimization, a very important topic. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about,
ObjectiveCode optimization, a very important topic. Some people may feel useless, some small places have what good change, change and do not change the efficiency of the operation of the code has any impact? That's the question I'm thinking about,
Code optimization is a very important topic. In general, the goal of code optimization is mainly two, one is to reduce the size of the code, and the other is to improve the efficiency of code operation.There are many details of code optimization,
Preface
Code optimization, a very important topic. Some people may feel useless, some small places have what good to modify, and do not change the operation of the Code to the efficiency of what impact it. This question I think so, like the whale
1, as far as possible to specify the final modifier class, method
A class with the final modifier is not derived. In the Java Core API, there are many examples of final application, such as java.lang.String, where the entire class is final.
Just like a whale eats shrimp, maybe a two-shelled shrimp is not very useful for a whale, but a lot of shrimp is eaten and the whale is naturally full.
Code optimization, perhaps a two optimization, to improve the efficiency of the code is not
Java code optimization is a very important step in Java programming development, Java code optimization to pay attention to detail optimization, a two-detail optimization, the effect is not small, but if everywhere can pay attention to code
I. Some of the modifiers provided in Java that can modify classes, variables, and methods, which are common in Java: abstract (abstract), static (static), public (common), protected (protected), Private ( private), synchronized (synchronous), native
1. Annotations (note: 5)
Annotation use style (annotation style)This check allows you to control the style of the annotations you want to use.Missing deprecated (lack of DEPRECAD)Check whether the Javadoc markup for the java.lang.Deprecated
Java language Idioms
1. Cycle
In an important cycle, the method call is eliminated when the loop terminates the judgment.For example: thefor (int i=0; iTo replace with ...for (int i=0; n=collection.size (); iUsually, move the loop index irrelevant
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.