mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 02:04:31 +08:00
style: include SUI_CONTAINS_BEFORE_ADD
(#5216)
This commit is contained in:
@ -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