Methods can be passed as arguments for functions. These are not actual method references, but more an auto mapping feature, which wraps methods into an interface implementation.
Lets suppose we have these methods:
publicfinal<I, O>Oread(finalI sample,finalFunction<I, O> strategy);protected<I, O>OonRead(finalI sample){// This would encapsulate the code}
It is possible using onRead as the strategy argument:
read(sample,this::onRead);
The read method only needs to call the strategy, and then it will make use of the onRead method, making these two operations equivalent: