The index of the first occurrence of item, starting from pos.

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

var a = [10,20,30,10,20,30]
assert a.index_of_from(20, 3)   == 4
assert a.index_of_from(20, 4)   == 4
assert a.index_of_from(20, 5)   == -1

Property definitions

core $ SequenceRead :: index_of_from
	# The index of the first occurrence of `item`, starting from pos.
	# Return -1 if `item` is not found.
	# Comparison is done with `==`.
	#
	#     var a = [10,20,30,10,20,30]
	#     assert a.index_of_from(20, 3)   == 4
	#     assert a.index_of_from(20, 4)   == 4
	#     assert a.index_of_from(20, 5)   == -1
	fun index_of_from(item: nullable Object, pos: Int): Int
	do
		var p = 0
		var i = iterator
		while i.is_ok do
			if p>=pos and i.item == item then return i.index
			i.next
			p += 1
		end
		return -1
	end
lib/core/collection/abstract_collection.nit:963,2--981,4

core $ AbstractArrayRead :: index_of_from
	redef fun index_of_from(item, pos) do
		var i = pos
		var len = length
		while i < len do
			if self[i] == item then
				return i
			end
			i += 1
		end
		return -1
	end
lib/core/collection/array.nit:68,2--78,4

pthreads $ ConcurrentSequenceRead :: index_of_from
	redef fun index_of_from(index, from)
	do
		mutex.lock
		var r = real_collection.index_of_from(index, from)
		mutex.unlock
		return r
	end
lib/pthreads/concurrent_collections.nit:220,2--226,4