mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00
style: include SUI_CONTAINS_BEFORE_ADD
(#5216)
This commit is contained in:
@ -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>
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user