summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/LinearSeqLike.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/LinearSeqLike.scala')
-rw-r--r--src/library/scala/collection/LinearSeqLike.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/library/scala/collection/LinearSeqLike.scala b/src/library/scala/collection/LinearSeqLike.scala
index 75c1edac66..ceb980ff80 100644
--- a/src/library/scala/collection/LinearSeqLike.scala
+++ b/src/library/scala/collection/LinearSeqLike.scala
@@ -13,6 +13,7 @@ import generic._
import mutable.ListBuffer
import immutable.List
import scala.util.control.Breaks._
+import annotation.tailrec
/** A template trait for linear sequences of type `LinearSeq[A]`.
*
@@ -69,4 +70,9 @@ trait LinearSeqLike[+A, +Repr <: LinearSeqLike[A, Repr]] extends SeqLike[A, Repr
xs
}
}
+
+ @tailrec override final def corresponds[B](that: GenSeq[B])(p: (A,B) => Boolean): Boolean = {
+ if (this.isEmpty) that.isEmpty
+ else that.nonEmpty && p(head, that.head) && (tail corresponds that.tail)(p)
+ }
}