Swap Function in Kotlin -


is there better way write generic swap function in kotlin other java way described in how write basic swap function in java.

is there kotlin language feature can make generic swap function more concise , intuitive?

no need swap function in kotlin @ all. can use existing also function, example:

var = 1 var b = 2  = b.also { b = }  println(a) // print 2 println(b) // print 1 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -