We would like to know how to create Converter functional interface.
//www . j ava2 s . co m public class Main { public static void main(String... args) { Converter<String, Integer> integerConverter1 = (from) -> Integer.valueOf(from); Integer converted1 = integerConverter1.convert("123"); System.out.println(converted1); // result: 123 } } @FunctionalInterface interface Converter<F, T> { T convert(F from); }
The code above generates the following result.