résolution de conflit après stash pop

This commit is contained in:
Bezza Younes 2025-04-11 10:49:13 +02:00
parent ae4152eae8
commit 8a304e8807

View file

@ -34,11 +34,14 @@ public class Path {
public static Path createFastestPathFromNodes(Graph graph, List<Node> nodes)
throws IllegalArgumentException {
if (nodes == null || nodes.isEmpty())
if (nodes == null || nodes.isEmpty()) {
return new Path(graph);
if (nodes.size() == 1)
return new Path(graph, nodes.get(0));
// throw new IllegalArgumentException("La liste des nodes est vide"); ici il
// ne faut pas throw une erreur mais return un chemin vide.
}
if (nodes.size() == 1) {
return new Path(graph, nodes.get(0)); /* chemin de 1 point(node) */
}
ArrayList<Arc> finalList = new ArrayList<>();
for (int i = 0; i < nodes.size() - 1; i++) {