aboutsummaryrefslogtreecommitdiff
path: root/src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-04-29 06:03:56 +0200
committerJonas Smedegaard <dr@jones.dk>2025-04-29 06:11:41 +0200
commita5c3599d7bc7a9ef5583ad2d50a55975f030fbea (patch)
treedb4ed74e48997d4b4450148116a9c990978a1641 /src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java
parent03d2d06e8f5bfadd79912efb94e8931e54296735 (diff)
declare variables final when possible
Diffstat (limited to 'src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java')
-rw-r--r--src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java b/src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java
index babaaaa..765eeca 100644
--- a/src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java
+++ b/src/com.example.portfolio3/com/example/portfolio3/AdjListGraph.java
@@ -18,7 +18,7 @@ public class AdjListGraph extends AbstractGraph {
private Map<Vertex,Set<Edge>> outEdge= new HashMap<>();
/// foo
- public void insertEdge(Vertex v1,Vertex v2,int w){
+ public void insertEdge(final Vertex v1, final Vertex v2, final int w){
Edge e=new Edge(v1,v2,w);
if(!outEdge.containsKey(e.from()))
outEdge.put(e.from(),new HashSet<Edge>());
@@ -33,14 +33,14 @@ public class AdjListGraph extends AbstractGraph {
}
/// foo
- public Collection<Edge> outEdge(Vertex v){
+ public Collection<Edge> outEdge(final Vertex v){
if(!outEdge.containsKey(v))
return new HashSet<Edge>();
return outEdge.get(v);
}
/// foo
- public Integer getWeight(Vertex v1,Vertex v2){
+ public Integer getWeight(final Vertex v1, final Vertex v2){
// linear in number of outedges from vertices
if(!outEdge.containsKey(v1))return null;
for(Edge e:outEdge.get(v1)){