View by Classes

Findings - Overview

code-style OptimizableToArrayCall (PMD)

This call to Collection.toArray() may be optimizable

Further info on the wiki.
A call to Collection.toArray can use the Collection's size vs an empty Array of the desired type.
  
class Foo {
 void bar(Collection x) {
   // A bit inefficient
   x.toArray(new Foo[0]);
   // Much better; this one sizes the destination array, avoiding
   // a reflection call in some Collection implementations
   x.toArray(new Foo[x.size()]);
 }
}
  
      

Additional info can be found at this http://pmd.sourceforge.net/rules/design.html#OptimizableToArrayCall site.

1org.jcoderz.phoenix.jcoverage.Instrumenter
 [262:28]