Skip to content

Commit 1a9ff13

Browse files
authored
Merge branch 'master' into enable_AvoidNestedBlocks
2 parents 959e929 + 31db1af commit 1a9ff13

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

spotbugs-exclude.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@
222222
<Match>
223223
<Bug pattern="IMC_IMMATURE_CLASS_BAD_SERIALVERSIONUID" />
224224
</Match>
225-
<Match>
226-
<Bug pattern="SUI_CONTAINS_BEFORE_ADD" />
227-
</Match>
228225
<Match>
229226
<Bug pattern="DRE_DECLARED_RUNTIME_EXCEPTION" />
230227
</Match>

src/main/java/com/thealgorithms/datastructures/graphs/ConnectedComponent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public int countGraphs() {
8181
Set<Node> markedNodes = new HashSet<Node>();
8282

8383
for (Node n : nodeList) {
84-
if (!markedNodes.contains(n)) {
85-
markedNodes.add(n);
84+
if (markedNodes.add(n)) {
8685
markedNodes.addAll(depthFirstSearch(n, new ArrayList<Node>()));
8786
count++;
8887
}

0 commit comments

Comments
 (0)