Answers for "kotlin what is .apply"

2

apply in kotlin

fun main(args: Array<String>) 
{ 
    data class GFG(var name1 : String, var name2 : String,var name3 : String) 
    // instantiating object of class 
    var gfg = GFG("Geeks","for","hi") 
    // apply function invoked to change the name3 value 
    gfg.apply { this.name3 = "Geeks" } 
    println(gfg) 
}
Posted by: Guest on March-22-2021
-1

kotlin apply

return EditAccessoryFragment().apply {
    arguments = bundleOf(ACCESSORY_ID_LABEL to accessoryID)
}
Posted by: Guest on January-23-2021

Code answers related to "kotlin what is .apply"

Browse Popular Code Answers by Language