style: include SUI_CONTAINS_BEFORE_ADD (#5216)

This commit is contained in:
Piotr Idzik
2024-06-13 19:27:49 +02:00
committed by GitHub
parent a2af09cdfb
commit 31db1af345
2 changed files with 1 additions and 5 deletions

View File

@ -222,9 +222,6 @@
<Match> <Match>
<Bug pattern="IMC_IMMATURE_CLASS_BAD_SERIALVERSIONUID" /> <Bug pattern="IMC_IMMATURE_CLASS_BAD_SERIALVERSIONUID" />
</Match> </Match>
<Match>
<Bug pattern="SUI_CONTAINS_BEFORE_ADD" />
</Match>
<Match> <Match>
<Bug pattern="DRE_DECLARED_RUNTIME_EXCEPTION" /> <Bug pattern="DRE_DECLARED_RUNTIME_EXCEPTION" />
</Match> </Match>

View File

@ -81,8 +81,7 @@ class Graph<E extends Comparable<E>> {
Set<Node> markedNodes = new HashSet<Node>(); Set<Node> markedNodes = new HashSet<Node>();
for (Node n : nodeList) { for (Node n : nodeList) {
if (!markedNodes.contains(n)) { if (markedNodes.add(n)) {
markedNodes.add(n);
markedNodes.addAll(depthFirstSearch(n, new ArrayList<Node>())); markedNodes.addAll(depthFirstSearch(n, new ArrayList<Node>()));
count++; count++;
} }