Commit 605812c4 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch10b] Moving on to SongV3, which meant moving some of the misc playground...

[Ch10b] Moving on to SongV3, which meant moving some of the misc playground stuff into 10b, and simplifying Jukebox3 to use SongV3 with the (now working) sort. Means we can remove a bunch of unused Jukebox code too
parent 2ce664a9
Loading
Loading
Loading
Loading
+6 −9
Changes for src/main/java/ch10b/Jukebox3.java: 6 added lines, 9 removed lines.
Original line number Diff line number Diff line
package ch10b;

import java.util.List;
import java.util.*;

public class Jukebox3 {

  List<SongV2> mySongs;

  public static void main(String[] args) {
    new Jukebox3().go();
  }

  public void go() {
    mySongs = MockSongs.getSongsV2();
    System.out.println(mySongs);
    // This line intentionally fails compilation
//        Collections.sort(mySongs);
    System.out.println(mySongs);
    List<SongV3> songList = MockSongs.getSongsV3();
    System.out.println(songList);

    Collections.sort(songList);
    System.out.println(songList);
  }
}
 No newline at end of file
+0 −21
Changes for src/main/java/ch10b/Jukebox3Works.java: 0 added lines, 21 removed lines.
Original line number Diff line number Diff line
package ch10b;

import java.util.Collections;
import java.util.List;

public class Jukebox3Works {

  List<SongV3> mySongs;
  MockSongV2File mockFile = new MockSongV2File();

  public static void main(String[] args) {
    new Jukebox3Works().go();
  }

  public void go() {
    mySongs = mockFile.getSongsV3();
    System.out.println(mySongs);
    Collections.sort(mySongs);
    System.out.println(mySongs);
  }
}
 No newline at end of file

src/main/java/ch10b/Jukebox4.java

deleted100644 → 0
+0 −21
Changes for src/main/java/ch10b/Jukebox4.java: 0 added lines, 21 removed lines.
Original line number Diff line number Diff line
package ch10b;

import java.util.Collections;
import java.util.List;

public class Jukebox4 {

  List<SongV3> mySongs;
  MockSongV2File mockFile = new MockSongV2File();

  public static void main(String[] args) {
    new Jukebox4().go();
  }

  public void go() {
    mySongs = mockFile.getSongsV3();
    System.out.println(mySongs);
    Collections.sort(mySongs);
    System.out.println(mySongs);
  }
}
 No newline at end of file
+1 −2
Changes for src/main/java/ch10b/LambdaForEach.java: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
import ch10b.MockSongV2File;
import ch10b.SongV3;
package ch10b;

import java.util.Collections;
import java.util.List;
+11 −0
Changes for src/main/java/ch10b/MockSongs.java: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,4 +27,15 @@ class MockSongs {
    return mySongs;
  }

  public static List<SongV3> getSongsV3() {
    List<SongV3> mySongs = new ArrayList<>();
    mySongs.add(new SongV3("somersault", "zero 7", "50"));
    mySongs.add(new SongV3("cassidy", "grateful dead", "65"));
    mySongs.add(new SongV3("$10", "hitchhiker", "80"));

    mySongs.add(new SongV3("havana", "cabello", "60"));
    mySongs.add(new SongV3("Cassidy", "grateful dead", "65"));
    mySongs.add(new SongV3("50 ways", "simon", "70"));
    return mySongs;
  }
}
Loading