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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 5 deletions

View File

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

View File

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