Commit b6e85ff0 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch12] Changed one of the songs; updated some of the code as per feedback

parent 44a003a8
Loading
Loading
Loading
Loading
+1 −1
Changes for src/main/java/ch12/JukeboxData.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ public class JukeboxData {
        new Song("The Outsider", "A Perfect Circle", "Alternative Rock", 2004, 312),
        new Song("With a Little Help from My Friends", "The Beatles", "Rock", 1967, 168),
        new Song("Come Together", "The Beatles", "Blues rock", 1968, 173),
        new Song("Come Together", "The Smokin' Mojo Filters", "Rock", 1995, 165),
        new Song("Come Together", "Ike & Tina Turner", "Rock", 1970, 165),
        new Song("With a Little Help from My Friends", "Joe Cocker", "Rock", 1968, 46),
        new Song("Immigrant Song", "Karen O", "Industrial Rock", 2011, 12),
        new Song("Breathe", "The Prodigy", "Electronic", 1996, 337),
+1 −1
Changes for src/main/java/ch12/JukeboxStreams.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class Songs {
            new Song("The Outsider", "A Perfect Circle", "Alternative Rock", 2004, 312),
            new Song("With a Little Help from My Friends", "The Beatles", "Rock", 1967, 168),
            new Song("Come Together", "The Beatles", "Blues rock", 1968, 173),
            new Song("Come Together", "The Smokin' Mojo Filters", "Rock", 1995, 165),
            new Song("Come Together", "Ike & Tina Turner", "Rock", 1970, 165),
            new Song("With a Little Help from My Friends", "Joe Cocker", "Rock", 1968, 46),
            new Song("Immigrant Song", "Karen O", "Industrial Rock", 2011, 12),
            new Song("Breathe", "The Prodigy", "Electronic", 1996, 337),
+3 −2
Changes for src/main/java/ch12/LimitWithStream.java: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7,13 +7,14 @@ import java.util.stream.Stream;
public class LimitWithStream {

  public static void main(String[] args) {
    noReusing();
    streamExamples();
  }

  void streamExamples() {
  static void streamExamples() {
    List<String> strings = List.of("I", "am", "a", "list", "of", "Strings");
    Stream<String> stream = strings.stream();
    Stream<String> limit = stream.limit(4);
    System.out.println("limit = " + limit);
  }

  void limitWithCountTerminal() {
+2 −2
Changes for src/test/java/ch12/JukeboxQueriesTest.java: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -262,9 +262,9 @@ class JukeboxQueriesTest {
    String songTitle = "With a Little Help from My Friends";
    List<String> result = allSongs.stream()
                                  .filter(song -> song.getTitle().equals(songTitle))
                                  .map(Song::getArtist)
                                  .map(song -> song.getArtist())
                                  .filter(artist -> !artist.equals("The Beatles"))
                                  .collect(toList());
                                  .collect(Collectors.toList());

    System.out.println("result = " + result);
  }