Skip to content

Instantly share code, notes, and snippets.

@Nublo
Created October 7, 2018 14:53
Show Gist options
  • Save Nublo/12a1a5db395d5e7ff4ae285e44952096 to your computer and use it in GitHub Desktop.
Save Nublo/12a1a5db395d5e7ff4ae285e44952096 to your computer and use it in GitHub Desktop.
operator fun <T> List<T>.plus(xs: List<T>): List<T> = when (xs.size) {
0 -> ArrayList(this)
else -> (this + xs.head) + xs.tail
}
operator fun <T> T.plus(xs: List<T>): List<T> = listOf(this) + xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment