@@ -36,12 +36,12 @@ object Searching {
36
36
37
37
class SearchImpl [A , Repr ](val coll : SeqLike [A , Repr ]) {
38
38
/** Search the sorted sequence for a specific element. If the sequence is an
39
- * `IndexedSeq `, a binary search is used. Otherwise, a linear search is used.
39
+ * `IndexedSeqLike `, a binary search is used. Otherwise, a linear search is used.
40
40
*
41
41
* The sequence should be sorted with the same `Ordering` before calling; otherwise,
42
42
* the results are undefined.
43
43
*
44
- * @see [[scala.collection.IndexedSeq ]]
44
+ * @see [[scala.collection.IndexedSeqLike ]]
45
45
* @see [[scala.math.Ordering ]]
46
46
* @see [[scala.collection.SeqLike ]], method `sorted`
47
47
*
@@ -54,18 +54,18 @@ object Searching {
54
54
*/
55
55
final def search [B >: A ](elem : B )(implicit ord : Ordering [B ]): SearchResult =
56
56
coll match {
57
- case _ : IndexedSeq [ A ] => binarySearch(elem, 0 , coll.length)(ord)
57
+ case _ : IndexedSeqLike [ A , Repr ] => binarySearch(elem, 0 , coll.length)(ord)
58
58
case _ => linearSearch(coll.view, elem, 0 )(ord)
59
59
}
60
60
61
61
/** Search within an interval in the sorted sequence for a specific element. If the
62
- * sequence is an IndexedSeq , a binary search is used. Otherwise, a linear search
62
+ * sequence is an `IndexedSeqLike` , a binary search is used. Otherwise, a linear search
63
63
* is used.
64
64
*
65
65
* The sequence should be sorted with the same `Ordering` before calling; otherwise,
66
66
* the results are undefined.
67
67
*
68
- * @see [[scala.collection.IndexedSeq ]]
68
+ * @see [[scala.collection.IndexedSeqLike ]]
69
69
* @see [[scala.math.Ordering ]]
70
70
* @see [[scala.collection.SeqLike ]], method `sorted`
71
71
*
@@ -81,7 +81,7 @@ object Searching {
81
81
final def search [B >: A ](elem : B , from : Int , to : Int )
82
82
(implicit ord : Ordering [B ]): SearchResult =
83
83
coll match {
84
- case _ : IndexedSeq [ A ] => binarySearch(elem, from, to)(ord)
84
+ case _ : IndexedSeqLike [ A , Repr ] => binarySearch(elem, from, to)(ord)
85
85
case _ => linearSearch(coll.view(from, to), elem, from)(ord)
86
86
}
87
87
0 commit comments