UPDATE: i modified the hashCode, now is a little better. :) but the problem is still there... :(
so, and modified my method too:
private Node getMinNode()
{
int min = 9999999; //value
Node minNode = new Node(); //key,index
for (Node key : this.distances.keySet()) {
int minOfNode= this.distances.get(key);
System.out.println("Key "+ key +", Value = " + minOfNode);
if(minOfNode<min)
{
min= minOfNode;
minNode= key;
System.out.println("Key minNode = " + minNode + ", Value minNode = " + minOfNode);
}
}
return minNode;
}
and there is the output: (the whitespace(, ,) in the lines would be an empty char) and this is not the end... this is only the first few row...
Key 66601, 3546492, 3546493, 228, f, Value = 9999999
Key 77393, 3628185, 3628186, 64, t, Value = 9999999
Key 0, 0, 0, 0, , Value = 0
Key minNode = 0, 0, 0, 0, , Value minNode = 0
Key 66601, 3546492, 3546493, 228, f, Value = 9999999
Key 77393, 3628185, 3628186, 64, t, Value = 9999999
(note: the element with 'Key 0, 0, 0, 0, , Value = 0' does exists, this is the startNode) in that constructor the attribs are initialized with the zeros, i know, so my main problem is, why is that happening? they are passed rigth out of the if(), but in the if() they arent i hope it's clearer what is my problem. :)
keyandminOfNodeare not changed in the loop, are you sure the twoprintlns don't print the same message? Can you show us the output? Also, you might want to slightly modify the secondprintln, so that they are better distinguishable.0,0,0,0at distance0, so the algorithm works as designed.