Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Comparator;
- import java.util.Objects;
- import org.svetovid.io.SvetovidReader;
- class Film implements Comparable<Film> {
- public final int idf;
- public final String naziv;
- public final String reditelj;
- public Film(int idf,String naziv,String reditelj) {
- this.idf=idf;
- this.naziv=naziv;
- this.reditelj=reditelj;
- }
- public String toString() {
- return "ID filma: " + idf + "Naziv: " + "Reditelj:" + reditelj;
- }
- @Override
- public int compareTo(Film that) {
- int rezultat=Objects.compare(this.naziv, that.naziv, String.CASE_INSENSITIVE_ORDER);
- if(rezultat==0) {
- rezultat=this.idf-that.idf;
- }
- return rezultat;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement