X-Git-Url: http://nitlanguage.org diff --git a/lib/standard/collection/collection.nit b/lib/standard/collection/collection.nit index 781cd54..0701cc7 100644 --- a/lib/standard/collection/collection.nit +++ b/lib/standard/collection/collection.nit @@ -11,11 +11,22 @@ # another product. # This module define several collection classes. -package collection +module collection -import abstract_collection import range import list -intrude import array # FIXME because of string.nit +import array import sorter import hash_collection +import union_find + +redef class Sequence[E] + + # Copy the content of `self` between `start` and `len` to a new Array. + fun subarray(start, len: Int): Array[E] + do + var a = new Array[E].with_capacity(len) + for i in [start .. start+len[ do a.add(self[i]) + return a + end +end