Skip to content

Instantly share code, notes, and snippets.

@vonwao
Created April 4, 2012 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vonwao/2305906 to your computer and use it in GitHub Desktop.
Save vonwao/2305906 to your computer and use it in GitHub Desktop.
kotlin extension function
fun List<Int>.swap(x : Int, y : Int) {
val tmp = this[x] // 'this' corresponds to the list
this[x] = this[y]
this[y] = tmp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment