This expression x -> x * elem;will be rejected to a static method, which looks like this:
private static Integer lambda$curring$0(int x, int y){
return x*y;
}
Since you are a capturingvariable eleminside lambda, lambda is called stateful lambda.
, map java.util.Function - , :
final class Test2$$Lambda$1 implements java.util.function.Function {
private final Integer arg$1;
private Test2$$Lambda$1(Integer arg$1){
this.arg$1 = arg$1;
}
private static java.util.function.Function get$Lambda(Integer i){
return new Test2$$Lambda$1(i);
}
public Integer apply(Integer x) {
return YourClass.lambda$curring$0(this.arg$1, x);
}
}
Function.apply ( ) Test2$$Lambda$1, factory get$Lambda. "" elem.
- , , .
Stream , 10 - map.
, - . ( ) , .