Guest User

Untitled

a guest
Nov 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. PriorityQueue<aeronaves> pil= new PriorityQueue();
  2. pil.offer(new aeronaves("avianca",500));
  3. pil.offer(new aeronaves("linux",400));
  4. pil.offer(new aeronaves("avianca",500));
  5. pil.offer(new aeronaves("tame",2000));
  6. pil.offer(new aeronaves("tame",500));
  7. pil.offer(new aeronaves("arca",200));
  8. while(!pil.isEmpty()){
  9. aeronaves ae= pil.poll();
  10. System.out.println("aerolina saliento: "+ae.getAerolinea()+"destino "+ae.getDestino());
  11. }
  12.  
  13.  
  14. @Override
  15. public int compareTo(aeronaves t) {
  16. if(t.getDestino<500){
  17. return -1;
  18. }
  19. if(t.getDestino>=500|| t.getDestino<1000){
  20. return 0;
  21. }else{
  22. return 1;
  23. }
  24. }
Add Comment
Please, Sign In to add comment