Does Java have an equivalent to Python\'s range(int, int)
method?
public int[] range(int start, int stop)
{
int[] result = new int[stop-start];
for(int i=0;i<stop-start;i++)
result[i] = start+i;
return result;
}
Forgive any syntax or style errors; I normally program in C#.
The "Functional Java" library allows to program in such a way to a limited degree, it has a range() method creating an fj.data.Array instance.
See:
Similarly the "Totally Lazy" library offers a lazy range method: http://code.google.com/p/totallylazy/