How Kotlin uses the apply function
This article will explain in detail how Kotlin uses the apply function. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Apply function
It looks very similar to with, but it is a little different. Apply can avoid creating builder, because the function called by the object can initialize itself according to its own needs, and then the apply function returns the same object:
User = User (). Apply {firstName = Double lastName = Thunder} on "Kotlin how to use the apply function" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.