dropLast method

  1. @useResult
KtList<T> dropLast(
  1. int n
)

Returns a list containing all elements except last n elements.

Implementation

@useResult
KtList<T> dropLast(int n) {
  var count = size - n;
  if (count < 0) {
    count = 0;
  }
  return take(count);
}