core :: SimpleCollection :: add_all
coll
.var a = [1,2]
a.add_all([3..5])
assert a.has(4) == true
assert a.has(10) == false
# Add each item of `coll`.
#
# var a = [1,2]
# a.add_all([3..5])
# assert a.has(4) == true
# assert a.has(10) == false
fun add_all(coll: Collection[E]) do for i in coll do add(i)
lib/core/collection/abstract_collection.nit:437,2--443,60
# Slight optimization for arrays
redef fun add_all(items)
do
var l = _length
var nl = l + items.length
if _capacity < nl then
enlarge nl
end
if items isa Array[E] then
var k = 0
while l < nl do
_items.as(not null)[l] = items._items.as(not null)[k]
l += 1
k += 1
end
else
for item in items do
_items.as(not null)[l] = item
l += 1
end
end
_length = nl
end
lib/core/collection/array.nit:349,2--373,4