compress method

Iterable<T> compress(
  1. Iterable<bool> selectors
)

Make an iterator that filters elements from data returning only those that have a corresponding element in selectors that evaluates to True.

Implementation

Iterable<T> compress(Iterable<bool> selectors) {
  return zip2(this, selectors)
      .where((element) => element.item2)
      .map((e) => e.item1);
}