Skip to content

Commit 9d94f93

Browse files
authored
Change edges parameter type to Iterable in findShortestPaths
Fixes SpotBugs warning OCP_OVERLY_CONCRETE_PARAMETER by using the more general Iterable interface instead of List. This improves API flexibility while maintaining backward compatibility since List implements Iterable.
1 parent 5a1b873 commit 9d94f93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/graph/BellmanFord.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public boolean hasNegativeCycle() {
142142
* @return Result object containing distances, paths, and negative cycle information
143143
* @throws IllegalArgumentException if vertices is non-positive or source is invalid
144144
*/
145-
public static Result findShortestPaths(int vertices, List<Edge> edges, int source) {
145+
public static Result findShortestPaths(int vertices, Iterable<Edge> edges, int source) {
146146
if (vertices <= 0) {
147147
throw new IllegalArgumentException("Number of vertices must be positive");
148148
}

0 commit comments

Comments
 (0)