Advertisement
spiny94

Untitled

Sep 13th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public List<Deposit> getDeposits() {
  2.  
  3. List<Deposit> deposits = new LinkedList<Deposit>();
  4.  
  5. Iterator<Operation> it = movements.iterator();
  6. while (it.hasNext()) {
  7. Operation o = it.next();
  8. if (d instanceof Deposit) {
  9. deposits.add(d);
  10.  
  11. }
  12. }
  13. Collections.sort(deposits, new Comparator<Deposit>() {
  14. public int compare(Deposit a, Deposit b) { //errore
  15. return (int) (b.getImport() - a.getImport());
  16.  
  17. }
  18. });
  19. return deposits;
  20. }
  21.  
  22. public List<Withdrawal> getWithdrawals() {
  23. List<Withdrawal> withdrawals = new LinkedList<Withdrawal>();
  24. Iterator<Operation> it = movements.iterator();
  25. while (it.hasNext()) {
  26. Operation o = it.next();
  27. if (w instanceof Withdrawal) {
  28. withdrawals.add(w);
  29. }
  30. }
  31.  
  32. Collections.sort(withdrawals, new Comparator<Withdrawal>() {
  33. public int compare(Withdrawal a, Withdrawal b) { //errore
  34. return (int) (b.getImport() - a.getImport());
  35.  
  36. }
  37. });
  38. return withdrawals;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement