So MyProcess::new will meet fit the requirements for Supplier (Returning an object, and calling a method/constructor with no arguments because get() takes no arguments)Basically, when you do Supplier<MyProcessor> s = MyProcessor:new; you are telling the compiler to get you the constructor reference of the constructor that does not take any argument. This is because Supplier's functional method does not take any argument.
Code: Select all
public void debug(){ System.out.println(name+":"+marks); }
...
slist.stream().forEach(Student::debug);