Iterable<E> getRange(int start, int end)

Returns an Iterable that iterates over the objects in the range start inclusive to end exclusive.

The provide range, given by start and end, must be valid at the time of the call.

A range from start to end is valid if 0 <= start <= end <= len, where len is this list's length. The range starts at start and has length end - start. An empty range (with end == start) is valid.

The returned Iterable behaves like skip(start).take(end - start). That is, it does not throw if this list changes size.

List<String> colors = ['red', 'green', 'blue', 'orange', 'pink'];
Iterable<String> range = colors.getRange(1, 4);
range.join(', ');  // 'green, blue, orange'
colors.length = 3;
range.join(', ');  // 'green, blue'

Source

Iterable<E> getRange(int start, int end);