Guest User

Untitled

a guest
Jan 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Song searchSong = new Song(artistInput, artistInput, artistInput);
  2. int search = Arrays.binarySearch(songs, searchSong, new compare<Song>());
  3.  
  4. public int compare (Song firstSong, Song secondSong) {
  5. return firstSong.getArtist().compareTo(secondSong.getArtist());
  6. }
  7.  
  8. Song searchSong = new Song(artistInput, artistInput, artistInput);
  9. int search = Arrays.binarySearch(songs, searchSong, new Comparator<Song>(){
  10. @Override
  11. public int compare(Song s1, Song s2) {
  12. return s1.getArtist().compareTo(s2.getArtist());
  13. }
  14. });
  15.  
  16. public class MyComparator implements Comparator<Song> {
  17. /** Your compare method ***/
  18. }
Add Comment
Please, Sign In to add comment