The index of the last occurrence of item starting from pos and decrementing.

Return -1 if item is not found. Comparison is done with ==.

var a = [10,20,30,10,20,30]
assert a.last_index_of_from(20, 2)   == 1
assert a.last_index_of_from(20, 1)   == 1
assert a.last_index_of_from(20, 0)   == -1

Property definitions

core $ SequenceRead :: last_index_of_from
	# The index of the last occurrence of `item` starting from `pos` and decrementing.
	# Return -1 if `item` is not found.
	# Comparison is done with `==`.
	#
	#     var a = [10,20,30,10,20,30]
	#     assert a.last_index_of_from(20, 2)   == 1
	#     assert a.last_index_of_from(20, 1)   == 1
	#     assert a.last_index_of_from(20, 0)   == -1
	fun last_index_of_from(item: nullable Object, pos: Int): Int do
		var i = pos
		while i >= 0 do
			if self[i] == item then return i
			i -= 1
		end
		return -1
	end
lib/core/collection/abstract_collection.nit:983,2--998,4

core $ AbstractArrayRead :: last_index_of_from
	redef fun last_index_of_from(item, pos)	do
		var i = pos
		while i >= 0 do
			if self[i] == item then
				return i
			else
				i -= 1
			end
		end
		return -1
	end
lib/core/collection/array.nit:80,2--90,4

pthreads $ ConcurrentSequenceRead :: last_index_of_from
	redef fun last_index_of_from(e, from)
	do
		mutex.lock
		var r = real_collection.last_index_of_from(e, from)
		mutex.unlock
		return r
	end
lib/pthreads/concurrent_collections.nit:252,2--258,4