I need your help, I created this two classes
public class Arch <N,T>{
T label;
N start;
N end;
...constructor...
public class Graph <N,T>{
private ArrayList<N> nodes;
private HashMap<N,ArrayList<T>> arch; //for each Node I have saved an arrayList of Archs
//connected to him
private int nNode;
private int nArch;
private boolean oriented;
...constructor..
I need a method in Graph to delete an Arch from the ArrayList that I have in the hashmap.
I tried like this in the class Graph:
public void deleteArch(N start, N end){
ArrayList<Arch<N,T>> archsForNode=(ArrayList<Arch<N,T>>)arch.get(start);
for(Arch<N,T> a : archsForNode){
if(a.start==start || a.end == end) {
archsForNode.remove(a);
}
}
}
but when I tested it in my test main the result is that nothing changed in my ArrayList in the hashmap.
someone can help me please!
thank you all