All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.Optimization_Rules.html Maven / Gradle / Ivy



Optimization_Rules


Optimization_Rules

imization_Rules">

Optimization Rules

  • LocalVariableCouldBeFinal: A local variable assigned only once can be declared final.
  • MethodArgumentCouldBeFinal: A method argument that is never assigned can be declared final.
  • AvoidInstantiatingObjectsInLoops: Detects when a new object is created inside a loop
  • UseArrayListInsteadOfVector: ArrayList is a much better Collection implementation than Vector.
  • SimplifyStartsWith: Since it passes in a literal of length 1, this call to String.startsWith can be rewritten using String.charAt(0) to save some time.
  • UseStringBufferForStringAppends: Finds usages of += for appending strings.
  • UseArraysAsList: The class java.util.Arrays has a "asList" method that should be use when you want to create a new List from an array of objects. It is faster than executing a loop to cpy all the elements of the array one by one
  • AvoidArrayLoops: Instead of copying data between two arrays, use System.arraycopy method
  • UnnecessaryWrapperObjectCreation: Parsing method should be called directy instead.
  • AddEmptyString: Finds empty string literals which are being added. This is an inefficient way to convert any type to a String.




  • © 2015 - 2024 Weber Informatics LLC | Privacy Policy