diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/math/Ordered.scala | 30 | ||||
-rw-r--r-- | src/library/scala/util/matching/Regex.scala | 7 |
2 files changed, 14 insertions, 23 deletions
diff --git a/src/library/scala/math/Ordered.scala b/src/library/scala/math/Ordered.scala index 04d4c589a4..b67146942f 100644 --- a/src/library/scala/math/Ordered.scala +++ b/src/library/scala/math/Ordered.scala @@ -10,7 +10,7 @@ package scala.math /** A trait for data that have a single, natural ordering. See * [[scala.math.Ordering]] before using this trait for - * more information about whether to use use [[scala.math.Ordering]] instead. + * more information about whether to use [[scala.math.Ordering]] instead. * * Classes that implement this trait can be sorted with * [[scala.utils.Sorting]] and can be compared with standard comparison operators @@ -20,7 +20,8 @@ package scala.math * integers) while Ordering allows for multiple ordering implementations. * An Ordering instance will be implicitly created if necessary. * - * [[scala.math.Ordering]] is an alternative to this trait that allows multiple orderings to be defined for the same type. + * [[scala.math.Ordering]] is an alternative to this trait that allows multiple orderings to be + * defined for the same type. * * [[scala.math.PartiallyOrdered]] is an alternative to this trait for partially ordered data. * @@ -34,23 +35,16 @@ package scala.math * val result = scala.utils.Sorting.quickSort(x) * }}} * - * Some additional notes from the initial implementation: + * It is important that the `equals` method for an instance of `Ordered[A]` be consistent with the + * compare method. However, due to limitations inherent in the type erasure semantics, there is no + * reasonable way to provide a default implementation of equality for instances of `Ordered[A]`. + * Therefore, if you need to be able to use equality on an instance of `Ordered[A]` you must + * provide it yourself either when inheriting or instantiating. * - * Note that since version 2006-07-24 this trait is no longer covariant in `A`. - * - * It is important that the `equals` method for an instance of `Ordered[A]` - * be consistent with the compare method. However, due to limitations - * inherent in the type erasure semantics, there is no reasonable way to - * provide a default implementation of equality for instances of `Ordered[A]`. - * Therefore, if you need to be able to use equality on an instance of - * `Ordered[A]` you must provide it yourself either when inheriting or - * instantiating. - * - * It is important that the `hashCode` method for an instance of `Ordered[A]` - * be consistent with the `compare` method. However, it is not possible to - * provide a sensible default implementation. Therefore, if you need to be - * able compute the hash of an instance of `Ordered[A]` you must provide it - * yourself either when inheriting or instantiating. + * It is important that the `hashCode` method for an instance of `Ordered[A]` be consistent with + * the `compare` method. However, it is not possible to provide a sensible default implementation. + * Therefore, if you need to be able compute the hash of an instance of `Ordered[A]` you must + * provide it yourself either when inheriting or instantiating. * * @see [[scala.math.Ordering]], [[scala.math.PartiallyOrdered]] * @author Martin Odersky diff --git a/src/library/scala/util/matching/Regex.scala b/src/library/scala/util/matching/Regex.scala index 481a4e14a8..ac1cfa2705 100644 --- a/src/library/scala/util/matching/Regex.scala +++ b/src/library/scala/util/matching/Regex.scala @@ -413,11 +413,8 @@ object Regex { def unapply(m: Match): Some[String] = Some(m.matched) } - /** An extractor object that yields groups in the match. The main - * advantage of using this is extractor instead of using the original - * regex is that this avoids rematching the string. - * - * For example: + /** An extractor object that yields the groups in the match. Using an extractor + * rather than the original regex avoids recomputing the match. * * {{{ * import scala.util.matching.Regex.Groups |