title: Dijkstra's end condition
body: <p>With Dijkstra you use the end-condition</p>
  
  <pre><code>   while(!q.isEmpty()){
         //Some code
     }
  </code></pre>
  
  <p>But if you know the end node, is it not possible to change the end-condition to</p>
  
  <pre><code>   while(!q.peek().equals(endNode){
         //Some code
     }
  </code></pre>
  
  <p>Every implementation of Dijkstra I have seen uses the earlier, but the later is faster when you know the end node. Or is this not Dijkstra anymore?</p>