diff options
author | Paul Phillips <paulp@improving.org> | 2009-10-22 21:58:29 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-10-22 21:58:29 +0000 |
commit | dab03ce57930c24534e46664b676eab1928ca34a (patch) | |
tree | 0c6a0f3d22d821f868b8ccf82fe61c574297c26c /src/library/scala/collection/SeqLike.scala | |
parent | 99dae57ebb9204a8c99d063fa0666247134d109d (diff) | |
download | scala-dab03ce57930c24534e46664b676eab1928ca34a.tar.gz scala-dab03ce57930c24534e46664b676eab1928ca34a.tar.bz2 scala-dab03ce57930c24534e46664b676eab1928ca34a.zip |
Made sortBy unexperimental.
Diffstat (limited to 'src/library/scala/collection/SeqLike.scala')
-rw-r--r-- | src/library/scala/collection/SeqLike.scala | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala index a551a0b961..14227d4602 100644 --- a/src/library/scala/collection/SeqLike.scala +++ b/src/library/scala/collection/SeqLike.scala @@ -562,23 +562,21 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self => b.result } - /** Sort the sequence according to the Ordering which results from mapping + /** Sort the sequence according to the Ordering which results from transforming * the implicitly given Ordering[B] to an Ordering[A]. For example: * * <code> * val words = "The quick brown fox jumped over the lazy dog".split(' ') * // this works because scala.Ordering will implicitly provide an Ordering[Tuple2[Int, Char]] - * words.sortBy(x => (x.length, x.head.toLower)) - * res0: Array[String] = Array(dog, fox, The, the, lazy, over, brown, quick, jumped) + * words.sortBy(x => (x.length, x.head)) + * res0: Array[String] = Array(The, dog, fox, the, lazy, over, brown, quick, jumped) * </code> * - * @param f the mapping function + * @param f the transformation function A => B * @param ord the Ordering[B] * @return the sorted representation */ - - @experimental - def sortBy[B](f: A => B)(implicit ord: Ordering[B]): Repr = sortWith(ord map f) + def sortBy[B](f: A => B)(implicit ord: Ordering[B]): Repr = sortWith(ord on f) /** * Overridden for efficiency. |