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);  }
@Test public void external() { assertEquals(4, countBandMembersExternal(Arrays.asList(SampleData.johnColtrane, SampleData.theBeatles))); }