summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/Searching.scala
Commit message (Collapse)AuthorAgeFilesLines
* SI-9605 Searching does not use binary search for ArrayRui Gonçalves2016-01-121-6/+6
| | | | Binary search should be used for every `IndexedSeqLike` instance and not only for `IndexedSeq`. According the Scaladoc, it is `IndexedSeqLike` that guarantees "constant-time or near constant-time element access and length computation".
* SI-7372 make binarySearch methods use the same parameters for the same things.Antoine Gourlay2014-06-121-5/+5
| | | | | | | | The public facing binarySearch method used an inclusive 'from' parameter, while the internal @tailrec one used an *exclusive* 'from' parameter. No wonder there was an off-by-one error somewhere. This makes both methods use the same exclusive 'from' parameter.
* SI-7372 fix wrong insertion point for binary & linear search.Antoine Gourlay2014-06-041-2/+2
| | | | | It should return the position the value would have if it was a part of the sequence. Somehow even the test was wrong.
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* Eliminated the accumulated feature warnings.Paul Phillips2013-04-231-2/+3
| | | | | | | | | No, this isn't busywork, how dare you suggest such a thing. I intend my tombstone to say HERE LIES EXTEMPORE, WHO ELIMINATED A LOT OF SIP-18 WARNINGS REST IN PEACE
* Updated copyright to 2013Carlo Dapor2013-01-021-1/+1
|
* Fix scaladoc links in a couple of places.Eugene Vigdorchik2012-10-031-2/+2
|
* Changes suggested by @retronym and @jsuerethAlexander Clare2012-07-161-21/+37
| | | | | | Change return type to case classes, branch between functions depending on IndexedSeq instead of IndexedSeqLike, and alter tests accordingly. Clean up doc comments and reflect changes in them.
* SI-5906 Search for sorted sequencesAlexander Clare2012-07-121-0/+100
Augments sequence classes with search functionality, using binary search (comparable to that found in java.util.Collections) for indexed sequences and linear search for others.