slice method

  1. @override
IList<A> slice(
  1. int from,
  2. int until
)
override

Returns a new collection containing elements in the range [from, until).

Implementation

@override
IList<A> slice(int from, int until) {
  final lo = max(from, 0);

  if (until <= lo || isEmpty) {
    return Nil<A>();
  } else {
    return drop(lo).take(until - lo);
  }
}