I am trying to write an algorithm which utilizes a min-priority queue, so I looked around on google and found the PriorityQueue. It seems that in order to use it, though, I
As you can see here (the JSE Comparator JavaDoc page),
the Comparator interface has a generic "parameter"
describing the type
for which this comparator is designed.
The PriorityQueue is similar.
So,
if you create a PriorityQueue,
you can create a Comparator as follows:
public class distComparator implements Comparator {
@Override
public int compare(Node1 x, Node1 y){
return x.dist - y.dist;
}
}