Commit 709ced57 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch10b] Adding an example of sorting the TreeSet by a different value

parent 2e86388c
Loading
Loading
Loading
Loading
+8 −0
Changes for src/main/java/ch10b/Jukebox10.java: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,4 +17,12 @@ public class Jukebox10 {
    Set<SongV4> songSet = new TreeSet<>(songList);
    System.out.println(songSet);
  }

  public void go2() {
    List<SongV4> songList = MockMoreSongs.getSongsV4();

    Set<SongV4> songSet = new TreeSet<>((o1, o2) -> o1.getBpm() - o2.getBpm());
    songSet.addAll(songList);
    System.out.println(songSet);
  }
}