Commit 39bdc39c authored by Jan Hauer's avatar Jan Hauer 🌄
Browse files

Currying

parent e25f57e3
Pipeline #53790 failed with stages
package io.hauer.jax19.function;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import static io.hauer.jax19.function.Food.*;
......@@ -11,8 +11,8 @@ public class DuckApp {
public static void main(String[] args) {
BiFunction<Duck, Food[], Duck> duckDuckFunction = Duck::eatF;
DUCKS.stream().map(duck -> duckDuckFunction.apply(duck, FOOD)).forEach(System.out::println);
Function<Food[], Function<Duck, Duck>> duckDuckFunction = food -> duck -> duck.eatF(food);
DUCKS.stream().map(duckDuckFunction.apply(FOOD)).forEach(System.out::println);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment