This is the student class definition.
public class Student {
public Student(String name) {
this.name = name;
}
private String name;
public String getName() {
return name;
}
}
Run Code Online (Sandbox Code Playgroud)
The map function should accept like a Function interface
<R> Stream<R> map(Function<? super T, ? extends R> mapper);
Run Code Online (Sandbox Code Playgroud)
That means the parameters should be like that
int func(int a){
return b;
}
Run Code Online (Sandbox Code Playgroud)
We need to make sure have one method parameter.
So why getName() can work?
The method actually change to …