mapNotNull<R> method

Iterable<R> mapNotNull<R>(
  1. R? transform(
    1. T
    )
)

@internal The non-null results of calling transform on the elements of this.

Returns a lazy iterable which calls transform on the elements of this iterable in iteration order, then emits only the non-null values.

If transform throws, the iteration is terminated.

Implementation

Iterable<R> mapNotNull<R>(R? Function(T) transform) sync* {
  for (final e in this) {
    final v = transform(e);
    if (v != null) {
      yield v;
    }
  }
}