Salve, volevo capire perchè se creo un oggetto "TIPO" e istanzio una PriorityQueue<TIPO>
quando utilizzo "TIPO b = pq.peek();" perchè devo fare un casting?
pq.peek(): non dovrebbe restituire l'oggetto che ho inserito nella coda?

Esempio:
Codice PHP:
public class Studente{...}
private 
Comparator<Studentecmp = new Comparator<Studente>(){
            public 
int compare(Studente aStudente b){
                if(
a.getTipo()<b.getTipo() ){return -1;}
                else if(
a.getTipo()==b.getTipo()){ return 0; }
                return 
1;
            }
};
PriorityQueue<Studentepq PriorityQueue<Studente>(20cmp);
Studente a = new Studente(...);
pq.offer(a);
Studente b pq.peek();// qui mi da errore, dice che devo fare CASTING...PERCHE'? 
Grazie in anticipo.