requireNoNulls method

  1. @useResult
KtList<T> requireNoNulls()

Returns an original collection containing all the non-null elements, throwing an ArgumentError if there are any null elements.

Implementation

@useResult
KtList<T> requireNoNulls() {
  for (final element in iter) {
    if (element == null) {
      throw ArgumentError("null element found in $this.");
    }
  }
  return cast<T>();
}