package com.insightfullogic.java8.examples.chapter7;

import java.util.List;

import com.insightfullogic.java8.examples.chapter1.Album;
import com.insightfullogic.java8.examples.chapter1.Track;

public class CountLength {

	public long countRunningTime(List<Album> albums) {
		long count = 0;
		for (Album album : albums) {
			for (Track track : album.getTrackList()) {
				count += track.getLength();
			}
		}
		return count;
	}

}

@@ -443,11 +443,354 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09public long countMusicians(List%3CAlbum%3E albums) %7B%0D%0A%09%09long count = 0;%0D%0A%09%09for (Album album : albums) %7B%0D%0A%09%09%09count += album.getMusiciansList().size();%0D%0A%09%09%7D%0D%0A%09%09return count;%0D%0A%09%7D%0D%0A%0D%0A%09public long countTracks(List%3CAlbum%3E albums) %7B%0D%0A%09%09long count = 0;%0D%0A%09%09for (Album album : albums) %7B%0D%0A%09%09%09count += album.getTrackList().size();%0D%0A%09%09%7D%0D%0A%09%09return count;%0D%0A%09%7D%0D%0A
 %7D%0D%0A

complete CountLength class