Beispiel #1
0
  public int compare(Node first, Node second) {

    // I want to use the opposite order, so that I can build a max priority
    // queue using the default
    // implementation of a min priority queue
    Double firstDistance = first.getDistance();
    Double secondDistance = second.getDistance();
    return firstDistance.compareTo(secondDistance);
  }
Beispiel #2
0
  public boolean equals(Node first, Node second) {

    // I just want only one node with a given key in the priority queue
    if (first.getKey() == second.getKey()) return true;
    else return false;
  }