StringExercises { public static Optional<String> mostLowercaseString(List<String> strings) { return strings.stream() .max(Comparator.comparing(StringExercises::countLowercaseLetters)); }  static int countLowercaseLetters(String string); static Optional<String> mostLowercaseString(List<String> strings);  }
@Test public void noStringReturnedForEmptyList() { assertFalse(com.insightfullogic.java8.answers.chapter3.StringExercises.mostLowercaseString(Collections.<String>emptyList()).isPresent()); }
@Test public void findsMostLowercaseString() { Optional<String> result = StringExercises.mostLowercaseString(Arrays.asList("a", "abc", "ABCde")); assertEquals(result, Optional.of("abc")); }