dropLastWhile method

KtList<T> dropLastWhile(
  1. bool predicate(
    1. T
    )
)

Returns a list containing all elements except last elements that satisfy the given predicate.

Implementation

KtList<T> dropLastWhile(bool Function(T) predicate) {
  if (!isEmpty()) {
    final i = listIterator(size);
    while (i.hasPrevious()) {
      if (!predicate(i.previous())) {
        return take(i.nextIndex() + 1);
      }
    }
  }
  return emptyList<T>();
}