1. "Force" when using regular expressions, the use of its pre-compilation function, can effectively speed up the regular matching speed.
Description: Do not define in the method body: Pattern pattern = pattern.compile (rule);
2. When "force" velocity calls the properties of the Pojo class, it is recommended to use the property name value directly, and the template engine automatically presses
The specification calls Pojo's getXxx (), if it is a Boolean base data type variable (the Boolean name does not need to be
prefix), the Isxxx () method is called automatically.
Description: Note that if it is a Boolean wrapper class object, the GetXxx () method is called first.
3. "Force" the variables sent to the page in the background must be added $! {var}--an exclamation point in the middle.}
Description: If Var=null is not present, then ${var} will be displayed directly on the page.
4. "Force" note math.random () This method returns a double type, noting the range of values 0≤x<1 (capable
Take the zero value, note that except for the 0 exception), if you want to get a random number of type Integer, do not enlarge X by 10 times and then
Rounding, directly using the Nextint or Nextlong method of the Random object.
5. "Force" gets the current number of milliseconds system.currenttimemillis (); Instead of the new Date (). GetTime ();
Note: If you want to obtain a more accurate nanosecond time value, use System.nanotime (). In JDK8, for statistical
Time and other scenarios, we recommend using the Instant class.
6. "Recommended" Try not to include variable declarations, logical operators in the VM, or add any complex logic to the VM template.
Series.
7. "Recommended" the construction or initialization of any data structure should be specified in size to avoid unlimited growth in the data structure to eat up memory.
8. "Recommended" for "explicitly discontinued code and configuration" such as methods, variables, classes, configuration files, dynamic configuration properties
And so to be resolutely removed from the program, to avoid causing excessive rubbish.
Java Programming Specification-Other specifications