Advertisement
niske

Untitled

Oct 23rd, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import java.util.Comparator;
  2.  
  3. public class PoredjenjePoNazivu implements Comparator<Film> {
  4.  
  5. @Override
  6. public int compare(Film film1, Film film2) {
  7. int num = film1.naziv.compareTo(film2.naziv);
  8. if(num > 0) {
  9. return 1;
  10. }
  11. else if(num < 0) {
  12. return -1;
  13. }
  14. else {
  15. return 0;
  16. }
  17. }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement