drop method

KtList<T> drop(
  1. int n
)

Returns a list containing all elements except first n elements.

Implementation

KtList<T> drop(int n) {
  // TODO add exception if n is negative
  final list = mutableListOf<T>();
  var count = 0;
  for (final item in iter) {
    if (count++ >= n) {
      list.add(item);
    }
  }
  return list;
}