Sort on highest score
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package audio.sorting;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import audio.Song;
|
||||
|
||||
public class SortSCORE implements Comparator<Song> {
|
||||
|
||||
public int compare(Song s1, Song s2) {
|
||||
if(s1.getHighestScore() < s2.getHighestScore())
|
||||
return 1;
|
||||
else if(s1.getHighestScore() > s2.getHighestScore())
|
||||
return -1;
|
||||
else
|
||||
return s1.getTitle().compareTo(s2.getTitle());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user