You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implicitclassOptionValueOps[T](privatevalo:Option[T]) extendsAnyVal {
finaldefdiff(that: Iterable[T]):Option[T] = {
if (o.exists(that.contains)) Noneelse o
}
}
Note: o.exists(that.contains) should be more performant than that.exists(o.contains) when that.contains is more efficient than that.exists, e.g. for Set.
Activity
OndrejSpanel commentedon May 22, 2024
It can be even made a little bit more general:
Note:
o.exists(that.contains)should be more performant thanthat.exists(o.contains)whenthat.containsis more efficient thanthat.exists, e.g. forSet.