Add an item after the last one.

var a = [1,2,3]
a.push(10)
a.push(20)
assert a  == [1,2,3,10,20]

Property definitions

core $ Sequence :: push
	# Add an item after the last one.
	#
	#     var a = [1,2,3]
	#     a.push(10)
	#     a.push(20)
	#     assert a  == [1,2,3,10,20]
	fun push(e: E) is abstract
lib/core/collection/abstract_collection.nit:1112,2--1118,27

core $ List :: push
	# O(1)
	redef fun push(e)
	do
		var node = new ListNode[E](e)
		var tail = _tail
		if tail == null then
			_head = node
		else
			tail.next = node
			node.prev = tail
		end
		_tail = node
		length += 1
	end
lib/core/collection/list.nit:86,2--99,4

core $ CircularArray :: push
	redef fun push(item) do
		var l = length + 1
		enlarge(l)
		length = l

		var native = _native
		var cap = native.length
		var t = tail + 1
		if t >= cap then t -= cap

		native[t] = item
		tail = t
	end
lib/core/collection/circular_array.nit:100,2--112,4

more_collections $ UnrolledList :: push
	redef fun push(item)
	do
		var node = tail_node
		if not node.full then
			if node.tail_index < node.capacity then
				# There's room at the tail
				node.tail_index += 1
			else
				# Move everything over by `d`
				assert node.head_index > 0
				var d = node.head_index / 2 + 1
				node.move_head(node.length, d)
				for i in d.times do node.items[node.tail_index - i] = null
				node.head_index -= d
				node.tail_index += -d+1
			end
			node.items[node.tail_index-1] = item
		else
			# New node!
			node = new UnrolledNode[E](nodes_length)
			insert_node(node, tail_node, null)
			node.tail_index = 1
			node.items[0] = item
		end
		length += 1
	end
lib/more_collections/more_collections.nit:427,2--452,4

dom $ XMLEntities :: push
	redef fun push(e) do
		if not entities.has(e) then
			entities.add e
			e.parent = owner
		end
	end
lib/dom/xml_entities.nit:80,2--85,4

core $ AbstractArray :: push
	redef fun push(item) do add(item)
lib/core/collection/array.nit:216,2--34

core $ FlatBufferCharView :: push
	redef fun push(c)
	do
		target.add(c)
	end
lib/core/text/flat.nit:1254,2--1257,4

pthreads $ ConcurrentSequence :: push
	redef fun push(e)
	do
		mutex.lock
		real_collection.push e
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:348,2--353,4

pthreads $ ConcurrentList :: push
	redef fun push(e)
	do
		mutex.lock
		real_collection.push(e)
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:504,2--509,4

pthreads $ BlockingQueue :: push
	# Adding the signal to release eventual waiting thread(s)
	redef fun push(e) do
		mutex.lock
		real_collection.push(e)
		self.cond.signal
		real_collection.push(e)
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:560,2--567,4

pthreads $ ReverseBlockingQueue :: push
	# Adding the signal to release eventual waiting thread(s)
	redef fun push(e) do
		mutex.lock
		real_collection.push(e)
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:527,2--532,4

actors $ Mailbox :: push
	# Adding the signal to release eventual waiting thread(s)
	redef fun push(e) do
		mutex.lock
		if real_collection.is_empty and not actor.working then
			actor.working = true
			sys.active_actors.increment
			real_collection.push(e)
			self.cond.signal
		else
			real_collection.push(e)
		end
		mutex.unlock
	end
lib/actors/actors.nit:78,2--90,4