리턴타입 : 재네릭
파라미터 타입 : 기본형
InFunction<R> : public R apply(int value)
DoubleFunction<R>: public R apply(double value)
LongFunction<R>: public R apply(long value)
import java.util.function.IntBinaryOperator;
import java.util.function.IntFunction;
public class IntFunctionTest {
public static void main(String[] args) {
IntFunction<String> intFunction = new IntFunction<String>() {
@Override
public String apply(int value) {
return String.valueOf(value);
}
};
String result1 = intFunction.apply(100);
String result2 = intFunction.apply(123);
System.out.println(result1+result2); // 100123
}
}
댓글 영역