src/Pure/library.scala
changeset 63773 d1a5d10affc0
parent 63734 133e3e84e6fb
child 63781 af9fe0b6b78e
--- a/src/Pure/library.scala	Fri Sep 02 12:29:06 2016 +0200
+++ b/src/Pure/library.scala	Fri Sep 02 16:23:02 2016 +0200
@@ -188,10 +188,10 @@
   def remove[A, B](x: B)(xs: List[A]): List[A] = if (member(xs)(x)) xs.filterNot(_ == x) else xs
   def update[A](x: A)(xs: List[A]): List[A] = x :: remove(x)(xs)
 
-  def distinct[A](xs: List[A], eq: (A, A) => Boolean = (x: A, y: A) => x == y): List[A] =
+  def distinct[A](xs: List[A]): List[A] =
   {
     val result = new mutable.ListBuffer[A]
-    for (x <- xs if !result.exists(y => eq(x, y))) result += x
+    xs.foreach(x => if (!result.contains(x)) result += x)
     result.toList
   }
 }