takeRight method
Returns a new collection with the last n elements of this collection.
If n is greater than the size of this collection, the original
collection is returned.
Implementation
@override
IList<A> takeRight(int n) {
if (isEmpty || n <= 0) return Nil<A>();
var lead = drop(n);
var lag = this;
while (lead.nonEmpty) {
lead = lead.tail;
lag = lag.tail;
}
return lag;
}