intersect method

Iterable<T> intersect(
  1. Iterable<T> l
)

Return the intersection of two Iterable (all the elements that both Iterable have in common).

Implementation

Iterable<T> intersect(Iterable<T> l) =>
    foldLeft([], (a, e) => l.elem(e) ? [...a, e] : a);