Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Comparator;
- public class PoredjenjePoRediteljuNazivu implements Comparator<Film> {
- @Override
- public int compare(Film film1, Film film2) {
- int num = film1.naziv.compareTo(film2.naziv);
- if(num > 0) {
- return 1;
- }
- else if(num < 0) {
- return -1;
- }
- else {
- num = film1.naziv.compareTo(film2.naziv);
- if(num > 0) {
- return 1;
- }
- else if(num < 0) {
- return -1;
- }
- else {
- return 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement