Files
kotlin-fork/js/js.translator/testData/operatorOverloading/cases/overloadPlusAssignViaPlusExtensionFunction.kt
T
Evgeny Gerashchenko 90b065e82b += tests fix
2014-07-29 12:06:36 +04:00

20 lines
381 B
Kotlin

package foo
import java.util.*
fun <T> ArrayList<T>.plus(other: Collection<T>): ArrayList<T> {
val c = ArrayList<T>()
c.addAll(this)
c.addAll(other)
return c
}
fun box(): Boolean {
var v1 = ArrayList<String>()
val v2 = ArrayList<String>()
v1.add("foo")
v2.add("bar")
v1 += v2
return (v1.size() == 2 && v1[0] == "foo" && v1[1] == "bar")
}