I am working on a problem where I must take these \"Song-artist pairs\" from an input file and sort alphabetically. The guidelines to the sorting goes like so:
In your compare method, compare the song titles if the artists names are identical. Like this:
public static class SongComparator implements Comparator{
public int compare(Song a, Song b){
int rslt a.effectiveAuthor().compareTo(b.effectiveAuthor());
if (rslt ==0)
{
// compare song names
rslt = a.getSongName().compareTo(b.getSongName());
}
return rslt;
}
}