aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Decorators.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/Decorators.scala')
-rw-r--r--src/dotty/tools/dotc/core/Decorators.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala
index eb287f411..ca601cddf 100644
--- a/src/dotty/tools/dotc/core/Decorators.scala
+++ b/src/dotty/tools/dotc/core/Decorators.scala
@@ -105,6 +105,12 @@ object Decorators {
else ys.nonEmpty && loop(xs.tail, ys.tail)
loop(xs, ys)
}
+
+ /** Union on lists seen as sets */
+ def | (ys: List[T]): List[T] = xs ++ (ys filterNot (xs contains _))
+
+ /** Intersection on lists seen as sets */
+ def & (ys: List[T]): List[T] = xs filter (ys contains _)
}
implicit class ListOfListDecorator[T](val xss: List[List[T]]) extends AnyVal {