Rather than create a collection, then call addAll to populate, the collection can be created with the collection to clone.

This commit is contained in:
Anthony Whitford
2015-09-07 14:48:23 -07:00
parent df25bbb6d2
commit af0255ee09
2 changed files with 2 additions and 4 deletions

View File

@@ -366,8 +366,7 @@ public class Engine implements FileFilter {
* This is okay for adds/deletes because it happens per analyzer. * This is okay for adds/deletes because it happens per analyzer.
*/ */
LOGGER.debug("Begin Analyzer '{}'", a.getName()); LOGGER.debug("Begin Analyzer '{}'", a.getName());
final Set<Dependency> dependencySet = new HashSet<Dependency>(); final Set<Dependency> dependencySet = new HashSet<Dependency>(dependencies);
dependencySet.addAll(dependencies);
for (Dependency d : dependencySet) { for (Dependency d : dependencySet) {
boolean shouldAnalyze = true; boolean shouldAnalyze = true;
if (a instanceof FileTypeAnalyzer) { if (a instanceof FileTypeAnalyzer) {

View File

@@ -154,8 +154,7 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
*/ */
@SuppressWarnings("null") @SuppressWarnings("null")
private void removeSpuriousCPE(Dependency dependency) { private void removeSpuriousCPE(Dependency dependency) {
final List<Identifier> ids = new ArrayList<Identifier>(); final List<Identifier> ids = new ArrayList<Identifier>(dependency.getIdentifiers());
ids.addAll(dependency.getIdentifiers());
Collections.sort(ids); Collections.sort(ids);
final ListIterator<Identifier> mainItr = ids.listIterator(); final ListIterator<Identifier> mainItr = ids.listIterator();
while (mainItr.hasNext()) { while (mainItr.hasNext()) {