### Question:
LambdaExamples { public static int useFunction(Function<String, Integer> function){ String input = "foo"; return function.apply(input); }  static void useRunnable(Runnable runnable); static void useConsumer(Consumer<String> consumer); static String usePredicate(Predicate<String> predicate); static int useFunction(Function<String, Integer> function);  }### Answer:
@Test public void testFunction(){ Function<String, Integer> anonymousClass = new Function<String, Integer>() { @Override public Integer apply(String s) { return s.length(); } }; Function<String, Integer> lambda = s -> 5; assertEquals(3, LambdaExamples.useFunction(anonymousClass)); assertEquals(5, LambdaExamples.useFunction(lambda)); assertEquals(6, LambdaExamples.useFunction(s -> s.length() * 2)); }