private void addOrUpdateNode(AStarNode newNode){
  boolean found=false;
  for (  AStarNode toUpdate : closedNodes) {
    if (newNode.equals(toUpdate)) {
      toUpdate.updateDistance(newNode.getG(),newNode.parent);
      found=true;
      break;
    }
  }
  if (!found) {
    openQueue.offer(newNode);
  }
}

private void addOrUpdateNode ( AStarNode newNode ) { boolean found = false ; for ( AStarNode toUpdate : closedNodes ) { if ( newNode . equals ( toUpdate ) ) { toUpdate . updateDistance ( newNode . getG ( ) , newNode . parent ) ; found = true ; break ; } } if ( ! found ) { openQueue . offer ( newNode ) ; } }
adds a new astarnode to the queue unless it is already among the closed nodes , in which case it only updates the closed node with the new distance .
