@@ -0,0 +1,615 @@
+package com.yutax77.java8_ans.chap3;%0A%0Aimport java.util.function.BiFunction;%0A%0Aimport javafx.scene.image.Image;%0Aimport javafx.scene.image.WritableImage;%0Aimport javafx.scene.paint.Color;%0A%0Apublic class Ans6 %7B%0A    public static %3CT%3E Image transform(Image in, BiFunction%3CT, Color, Color%3E f, T arg) %7B%0A%09int width = (int) in.getWidth();%0A%09int height = (int) in.getHeight();%0A%09WritableImage out = new WritableImage(width, height);%0A%09%0A%09for(int x = 0; x %3C width; x++) %7B%0A%09    for(int y = 0; y %3C height; y++) %7B%0A%09%09out.getPixelWriter().setColor(x, y, f.apply(arg, in.getPixelReader().getColor(x, y)));%0A%09    %7D%0A%09%7D%0A%09%0A%09return out;%0A    %7D%0A%7D%0A

Answer chap.3-6