doc(dijkstra): explain why we use an ArrayList
This commit is contained in:
parent
e5be8087f9
commit
5dfd14f3f2
1 changed files with 2 additions and 0 deletions
|
@ -36,6 +36,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
|||
|
||||
// Init Dijkstra
|
||||
for (Node node : graph.getNodes()) {
|
||||
// Luckily they are ordered by id.
|
||||
// ArrayList.set only works if the value is already initialized (because why Java?)
|
||||
labels.add(new Label(node));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue