Improve performance for addAll with type check for Collection
This commit is contained in:
committed by
Andrey Breslav
parent
65da4cb2fb
commit
132f2a5fa8
@@ -4,7 +4,10 @@ package kotlin
|
||||
* Adds all elements of the given *iterable* to this [[MutableCollection]]
|
||||
*/
|
||||
public fun <T> MutableCollection<in T>.addAll(iterable: Iterable<T>): Unit {
|
||||
for (e in iterable) add(e)
|
||||
when (iterable) {
|
||||
is Collection -> addAll(iterable)
|
||||
else -> for (e in iterable) add(e)
|
||||
}
|
||||
}
|
||||
|
||||
public fun <T> MutableCollection<in T>.addAll(stream: Stream<T>): Unit {
|
||||
|
||||
Reference in New Issue
Block a user