rename 'package' to 'module'
[nit.git] / lib / standard / collection / collection.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2009 Jean Privat <jean@pryen.org>
4 #
5 # This file is free software, which comes along with NIT. This software is
6 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 # is kept unaltered, and a notification of the changes is added.
10 # You are allowed to redistribute it and sell it, alone or is a part of
11 # another product.
12
13 # This module define several collection classes.
14 module collection
15
16 import abstract_collection
17 import range
18 import list
19 intrude import array # FIXME because of string.nit
20 import sorter
21 import hash_collection
22
23 redef class Sequence[E]
24 fun subarray(start, len: Int): Array[E]
25 do
26 var a = new Array[E].with_capacity(len)
27 for i in [start .. start+len[ do a.add(self[i])
28 return a
29 end
30 end