Functional Programming in Javaの書籍では、著者はFunction<T, U>
インターフェイスのみを使用して作成機能を作成します(インターフェイスはJava 8には含まれていませんが非常に似ています)。java 8で機能<>を使用して作成を実装する
public interface Function<T, U> {
U apply(T arg);
}
の下に、私は2つの機能を取り込み、下記コンの方法バージョンを、理解し、
public static final Function<Integer, Integer> compose (final Function<Integer, Integer> f1,
final Function<Integer, Integer> f2) {
arg -> f1.apply(f2.apply(arg));
}
は、私はちょうどのまわりで私の頭を取得できませんでした以下のimplementatiを構成する構成機能を返すことができても機能<と上>とラムダ
static Function<Function<Integer, Integer>,
Function<Function<Integer, Integer>,
Function<Integer, Integer>>> compose =
x -> y -> z -> x.apply(y.apply(z));
PS:このうち私の心を取得し、残りのセクションを進めることができませんでした:(
http://stackoverflow.com/questions/19834611/how-to-do-function- composition maybe –
私は与えられた関数で2つのfxnを作成する方法を見ていますが、その作成関数を実装する方法についての懸念がありました。 –
http://stackoverflow.com/questions/32820722/what-does-lambda-with-2arrows- mean-in-java-8/32820940 –