我想知道您使用了什么方法来避免在Mortar中对getView()进行重复的空检查?
发布于 2014-07-31 17:21:56
90%的时间是不必要的,因为一个方法正在响应从view-land发起的事情。在必要的情况下,响应某种异步事件…而发生的事情我们只是应付它。
public void omgTheServerSaid(Some thing) {
MyView view = getView();
if (view == null) return;
view.showIt(thing.it);
}
从现在开始,这就是让我想要用Kotlin编写的东西。
getView()?.showIt(thing.it);
https://stackoverflow.com/questions/24337643
复制