public void asyncLambda(Notifier notifier)
{
DataUtil.getDataAsync((data) -> {
// This code would be called on a new thread.
for(Object o : data)
{
notifier.notify(o);
}
});
}
它编译并运行(据我所知)。我好奇的是什么
notifier
我正在使用的对象。
我能想到的可能性是
-
提及
通知者
在原始调用传递到lambda时。
-
-
整个堆栈帧被复制到新线程中(这有点类似于第一种可能性,但现在可能存在的所有变量也在那里)。