Saturday, April 16, 2016

Java 8で関数を引数にスル

import java.util.function.Function;

public class Main {

    public static void main(String args[]){
        toUpperCase( x -> x.toUpperCase(), "abc");
    }
 
    private static void toUpperCase(Function<String, String> func, String arg){
        System.out.println(func.apply(arg));
    }

}

No comments:

Post a Comment