Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PriorityQueue<aeronaves> pil= new PriorityQueue();
- pil.offer(new aeronaves("avianca",500));
- pil.offer(new aeronaves("linux",400));
- pil.offer(new aeronaves("avianca",500));
- pil.offer(new aeronaves("tame",2000));
- pil.offer(new aeronaves("tame",500));
- pil.offer(new aeronaves("arca",200));
- while(!pil.isEmpty()){
- aeronaves ae= pil.poll();
- System.out.println("aerolina saliento: "+ae.getAerolinea()+"destino "+ae.getDestino());
- }
- @Override
- public int compareTo(aeronaves t) {
- if(t.getDestino<500){
- return -1;
- }
- if(t.getDestino>=500|| t.getDestino<1000){
- return 0;
- }else{
- return 1;
- }
- }
Add Comment
Please, Sign In to add comment