【发布时间】:2020-10-12 10:57:47
【问题描述】:
我的问题是,当我在 kotlin 中使用引用与“正常”方法(没有)时是否存在任何性能差异。假设我们要向ListAdapter 提交一个列表,我们可以使用两种方法。
接近一
shoppingCartViewModel.productList.observe(viewLifecycleOwner) {
it.let(shoppingCartAdapter::submitList)
}
方法二
shoppingCartViewModel.productList.observe(viewLifecycleOwner) {
shoppingCartAdapter.submitList(it)
}
首选的方法应该是什么?
【问题讨论】:
标签: android performance kotlin reflection