Switch from ArrayList to List in Graph.
这个提交包含在:
父节点
374e5e5f5c
当前提交
bc67e95f7f
共有 2 个文件被更改,包括 24 次插入 和 5 次删除
|
|
@ -1,6 +1,5 @@
|
||||||
package org.insa.graph;
|
package org.insa.graph;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -10,15 +9,15 @@ public class Graph {
|
||||||
private final int mapId;
|
private final int mapId;
|
||||||
|
|
||||||
// Nodes of the graph.
|
// Nodes of the graph.
|
||||||
private final ArrayList<Node> nodes;
|
private final List<Node> nodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mapId ID of this graph.
|
* @param mapId ID of this graph.
|
||||||
* @param nodes List of nodes for this graph.
|
* @param list List of nodes for this graph.
|
||||||
*/
|
*/
|
||||||
public Graph(int mapId, ArrayList<Node> nodes) {
|
public Graph(int mapId, List<Node> list) {
|
||||||
this.mapId = mapId;
|
this.mapId = mapId;
|
||||||
this.nodes = nodes;
|
this.nodes = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.insa.graph;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
|
public class PathTest {
|
||||||
|
|
||||||
|
// Small graph use for tests
|
||||||
|
private Graph graph;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void initAll() throws IOException {
|
||||||
|
Node[] nodes = new Node[] {};
|
||||||
|
|
||||||
|
graph = new Graph(0, Arrays.asList(nodes));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
正在加载…
在新工单中引用