ve la mando se potrà mai essere utile a qualcuno!
public static <K,V>void subtract (PriorityQueue<K,V> Q1, PriorityQueue <K,V> Q2 , Comparator<K>c){
PriorityQueue <K,V> P = new HeapPriorityQueue<K,V>();
Entry<K,V> m = null;
Entry<K,V> m1 = null;
while(!Q1.isEmpty()&&!Q2.isEmpty()){
m=Q1.min();
m1=Q2.min();
if(c.compare(m.getKey(), m1.getKey())<0){
P.insert(m.getKey(), m.getValue());
Q1.removeMin();
}
if(c.compare(m.getKey(), m1.getKey())==0){
Q1.removeMin();
}
if(c.compare(m.getKey(), m1.getKey())>0){
Q2.removeMin();
}}
while(!P.isEmpty()){
Entry<K,V> e=P.removeMin();
K ke = e.getKey();
V ve = e.getValue();
Q1.insert(ke,ve);
}
}

