package com.insightfullogic.java8.answers.chapter3;

import java.util.Comparator;
import java.util.List;
import java.util.Optional;

public class Question7 {

	// ȡַеСдĸ
	public static int countLowercaseLetters(String string) {
		return (int) string.chars()             //charsIntStream
				.filter(Character::isLowerCase)
				.count();
	}

	// ҳַб,Сдĸַ
	public static Optional<String> mostLowercaseString(List<String> strings) {
		return strings.stream()
				.max(Comparator.comparing(Question7::countLowercaseLetters));
	}
}

package com.insightfullogic.java8.answers.chapter3;

import java.util.Comparator;
import java.util.List;
import java.util.Optional;

public class Question7 {

	// ȡַеСдĸ
	public static int countLowercaseLetters(String string) {
		return (int) string.chars()             //charsIntStream
				.filter(Character::isLowerCase)
				.count();
	}

	// ҳַб,Сдĸַ
	// Optional,http://www.importnew.com/6675.html
	public static Optional<String> mostLowercaseString(List<String> strings) {
		return strings.stream()
				.max(Comparator.comparing(Question7::countLowercaseLetters));
	}
}

添加网页注释，详细介绍了Optional的使用