Build a new array from a collection

Property definitions

core :: array $ Collection :: to_a
	# Build a new array from a collection
	fun to_a: Array[E]
	do
		var res = new Array[E].with_capacity(length)
		res.add_all(self)
		return res
	end
lib/core/collection/array.nit:966,2--972,4

pthreads $ ConcurrentCollection :: to_a
	redef fun to_a
	do
		mutex.lock
		var r = real_collection.to_a
		mutex.unlock
		return r
	end
lib/pthreads/concurrent_collections.nit:148,2--154,4

ordered_tree $ OrderedTree :: to_a
	# Get an array of the contained elements
	# Order is preserved
	#
	#     var tree = new OrderedTree[Int]
	#     tree.add_all(null, [1, 2])
	#     tree.add_all(1, [11, 12])
	#     tree.add_all(11, [111, 112])
	#     tree.add_all(12, [121, 122])
	#     tree.add_all(2, [21, 22])
	#     assert tree.to_a == [1, 11, 111, 112, 12, 121, 122, 2, 21, 22]
	redef fun to_a: Array[E] do
		var res = new Array[E]
		for r in roots do sub_to_a(r, res)
		return res
	end
lib/ordered_tree/ordered_tree.nit:202,2--216,4