From 3d8c9c925de4064e7178a20510f77fb710581210 Mon Sep 17 00:00:00 2001 From: tboychuk Date: Mon, 1 Jul 2019 19:28:58 +0300 Subject: [PATCH] Complete new tasks in CrazyLambdas.java --- crazy-lambdas/src/main/java/com/bobocode/CrazyLambdas.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crazy-lambdas/src/main/java/com/bobocode/CrazyLambdas.java b/crazy-lambdas/src/main/java/com/bobocode/CrazyLambdas.java index 940a09e..6a329f1 100644 --- a/crazy-lambdas/src/main/java/com/bobocode/CrazyLambdas.java +++ b/crazy-lambdas/src/main/java/com/bobocode/CrazyLambdas.java @@ -32,7 +32,7 @@ public static Predicate isEmptyPredicate() { * @return function that repeats Strings */ public static BiFunction stringMultiplier() { - throw new UnsupportedOperationException("It's your job to implement this method"); // todo + return String::repeat; } /** @@ -120,7 +120,7 @@ public static Supplier nMultiplyFunctionSupplier(int n) { * @return function that composes functions with trim() function */ public static UnaryOperator> composeWithTrimFunction() { - throw new UnsupportedOperationException("It's your job to implement this method"); // todo + return stringFunction -> stringFunction.compose(String::trim); } /** @@ -182,7 +182,7 @@ public static BiFunction funct * @return a high-order function that fetches a function from a function map by a given name or returns identity() */ public static BiFunction, String, IntUnaryOperator> functionLoader() { - throw new UnsupportedOperationException("It's your job to implement this method"); // todo + return (functionMap, functionName) -> functionMap.getOrDefault(functionName, IntUnaryOperator.identity()); } /**