Skip to content

Instantly share code, notes, and snippets.

@msymt
Created May 27, 2020 02:29
Show Gist options
  • Save msymt/2ba2f8c6450c8b67c062dc092dce6a6f to your computer and use it in GitHub Desktop.
Save msymt/2ba2f8c6450c8b67c062dc092dce6a6f to your computer and use it in GitHub Desktop.
ジェネりくすと拡張関数
fun <T> MutableList<T>.swap(index1: Int, index2: Int) {
val tmp = this[index1]
this[index1] = this[index2]
this[index2] = tmp
}
/*
参考
https://dogwood008.github.io/kotlin-web-site-ja/docs/reference/extensions.html
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment