90% 的情况下它是不必要的,因为一种方法正在发生以响应从 view-land 发起的某些事情。在必要的情况下,为了响应某种异步事件而发生的事情……我们只是应付它。
public void omgTheServerSaid(Some thing) {
MyView view = getView();
if (view == null) return;
view.showIt(thing.it);
}
这就是让我从现在开始想用 Kotlin 写的东西。
getView()?.showIt(thing.it);