My question is, if there are any performance differences when I use references in kotlin versus the "normal" approach (without). Let's say, we want to submit a list to a ListAdapter
, we can use two approaches.
Approach one
shoppingCartViewModel.productList.observe(viewLifecycleOwner) {
it.let(shoppingCartAdapter::submitList)
}
Approach two
shoppingCartViewModel.productList.observe(viewLifecycleOwner) {
shoppingCartAdapter.submitList(it)
}
What should be the preferred approach?
Aucun commentaire:
Enregistrer un commentaire