@Test public void external() { assertEquals(4, countBandMembersExternal(Arrays.asList(SampleData.johnColtrane, SampleData.theBeatles))); }
public static int countBandMembersExternal(List<Artist> artists) { int totalMembers = 0; for (Artist artist : artists) { Stream<Artist> members = artist.getMembers(); totalMembers += members.count(); } return totalMembers; }
StreamExercises { public static int countBandMembersExternal(List<Artist> artists) { int totalMembers = 0; for (Artist artist : artists) { Stream<Artist> members = artist.getMembers(); totalMembers += members.count(); } return totalMembers; } }
StreamExercises { public static int countBandMembersExternal(List<Artist> artists) { int totalMembers = 0; for (Artist artist : artists) { Stream<Artist> members = artist.getMembers(); totalMembers += members.count(); } return totalMembers; }  }
StreamExercises { public static int countBandMembersExternal(List<Artist> artists) { int totalMembers = 0; for (Artist artist : artists) { Stream<Artist> members = artist.getMembers(); totalMembers += members.count(); } return totalMembers; }  static int countBandMembersExternal(List<Artist> artists); static List<R> map(Stream<T> stream, Function<T, R> mapper); }
StreamExercises { public static int countBandMembersExternal(List<Artist> artists) { int totalMembers = 0; for (Artist artist : artists) { Stream<Artist> members = artist.getMembers(); totalMembers += members.count(); } return totalMembers; }  static int countBandMembersExternal(List<Artist> artists); static List<R> map(Stream<T> stream, Function<T, R> mapper);  }