Set the last item.

Is equivalent with self[length-1] = item.

var a = [1,2,3]
a.last = 10
assert a == [1,2,10]

If the sequence is empty, last= is equivalent with self[0]= (thus with first=)

var b = new Array[Int]
b.last = 10
assert b == [10]

Property definitions

core $ Sequence :: last=
	# Set the last item.
	# Is equivalent with `self[length-1] = item`.
	#
	#     var a = [1,2,3]
	#     a.last = 10
	#     assert a == [1,2,10]
	#
	# If the sequence is empty, `last=` is equivalent with `self[0]=` (thus with `first=`)
	#
	#     var b = new Array[Int]
	#     b.last = 10
	#     assert b == [10]
	fun last=(item: E)
	do
		var l = length
		if l > 0 then
			self[l-1] = item
		else
			self[0] = item
		end
	end
lib/core/collection/abstract_collection.nit:1087,2--1107,4

core $ List :: last=
	# O(1)
	redef fun last=(e) do _tail.as(not null).item = e
lib/core/collection/list.nit:37,2--38,50

pthreads $ ConcurrentSequence :: last=
	redef fun last=(e)
	do
		mutex.lock
		real_collection.last = e
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:326,2--331,4