package com.insightfullogic.java8.examples.chapter7;

import java.util.List;
import java.util.logging.Logger;

import static java.util.stream.Collectors.toList;

public class Testing {

	private static final Logger logger = Logger.getLogger("LambdaTesting");

	public static List<String> allToUpperCase(List<String> words) {
		return words.stream().map(string -> string.toUpperCase()).collect(toList());
	}

	public static List<String> elementFirstToUpperCaseLambdas(List<String> strings) {
		return strings.stream().map(string -> {
			char firstChar = Character.toUpperCase(string.charAt(0));
			return firstChar + string.substring(1);
		}).collect(toList());
	}

	// ַתȡΪĺ,ȿʵֵ
	public static String firstTpUpperCase(String string) {
		char firstChar = Character.toUpperCase(string.charAt(0));
		return firstChar + string.substring(1);
	}

	public static List<String> elementFirstToUpperCase(List<String> strings) {
		return strings.stream().map(Testing::firstTpUpperCase).collect(toList());
	}
}

@@ -94,25 +94,219 @@
 til.
-logging.Logger;%0D%0A
+Set;%0D%0Aimport java.util.logging.Logger;%0D%0A%0D%0Aimport com.insightfullogic.java8.examples.chapter1.Album;%0D%0Aimport com.insightfullogic.java8.examples.chapter1.Artist;%0D%0A%0D%0Aimport static java.util.stream.Collectors.toSet;
 %0D%0Aim
@@ -356,16 +356,45 @@
 ist;%0D%0A%0D%0A
+import java.util.HashSet;%0D%0A%0D%0A
 public c
@@ -1243,11 +1243,907 @@
 );%0D%0A%09%7D%0D%0A
+%0D%0A%09// %D6%BE%CD%B4%D3%A1%CF%A2%0D%0A%09public static Set%3CString%3E imperativeNationalityReport(Album album) %7B%0D%0A%09%09Set%3CString%3E nationalities = new HashSet%3C%3E();%0D%0A%09%09for (Artist artist : album.getMusiciansList()) %7B%0D%0A%09%09%09if (artist.getName().startsWith(%22The%22)) %7B%0D%0A%09%09%09%09String nationality = artist.getNationality();%0D%0A%09%09%09%09System.out.println(%22Found nationality: %22 + nationality);%0D%0A%09%09%09%09nationalities.add(nationality);%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return nationalities;%0D%0A%09%7D%0D%0A%0D%0A%09public static Set%3CString%3E forEachLoggingFailure(Album album) %7B%0D%0A%09%09album.getMusicians()%0D%0A%09%09%09%09.filter(artist -%3E artist.getName().startsWith(%22The%22))%0D%0A%09%09%09%09.map(artist -%3E artist.getNationality())%0D%0A%09%09%09%09.forEach(nationality -%3E System.out.println(%22Found: %22 + nationality));%0D%0A%0D%0A%09%09Set%3CString%3E nationalities = album.getMusicians()%0D%0A%09%09%09%09.filter(artist -%3E artist.getName().startsWith(%22The%22))%0D%0A%09%09%09%09.map(artist -%3E artist.getNationality()).collect(toSet());%0D%0A%09%09return nationalities;%0D%0A%09%7D%0D%0A%0D%0A
 %7D%0D%0A

add example for logger