Before Java 8, lambda functionality could be achieved by using anonymous inner classes. For example:
interface Lambda {
void doStuff();
}
// ...
public void doWithCallback(Lambda callback) {
// ...
callback.doStuff();
}
// ...
doWithCallback(new Lambda {
public void doStuff() {
// ...
}
});
In terms of performance, is there a difference between still using this approach and using the new Java 8 lambdas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…