Java Closure 是什么
2020-04-28 本文已影响0人
affe
Java Closure
Google Neal on Java Closure
几个例子
// before
for(String s : strings) if(something(s)) return calculate(s);
// after
forEach(string, new OneArg<String>() {
public void invoke() {
if(something(s)) return calculate(s); // ERROR, you cannot return or break a loop
}
});