diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-03 17:34:31 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-03 17:34:31 +0000 |
commit | 96a42a2eda85489bb7dba25d9e8597bd35d7bcbd (patch) | |
tree | 51e3848b5d994cdaee75c9faefead41bc9e729d0 /test/files | |
parent | a6eecfb04532c83a715d520e885250e8de808f9e (diff) | |
download | scala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.tar.gz scala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.tar.bz2 scala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.zip |
Striking while the iron is hot, renamed removeD...
Striking while the iron is hot, renamed removeDuplicates to unique and
deprecated removeDuplicates. The debate between distinct and unique was
vigorous but unique won by a freckle. (Dark horse 'nub' was disqualified
for taking performance enhancers.) The only thing which might need
review is the choice of name, but review by odersky.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/Course-2002-13.scala | 4 | ||||
-rw-r--r-- | test/files/run/colltest1.scala | 4 | ||||
-rw-r--r-- | test/files/run/hashCodeBoxesRunTime.scala | 2 | ||||
-rw-r--r-- | test/files/run/hashCodeDistribution.scala | 2 | ||||
-rw-r--r-- | test/files/scalacheck/list.scala | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala index 27551b735b..fa5390e534 100644 --- a/test/files/run/Course-2002-13.scala +++ b/test/files/run/Course-2002-13.scala @@ -66,7 +66,7 @@ object Terms { override def toString() = a + (if (ts.isEmpty) "" else ts.mkString("(", ",", ")")); def map(s: Subst): Term = Con(a, ts map (t => t map s)); - def tyvars = (ts flatMap (t => t.tyvars)).removeDuplicates; + def tyvars = (ts flatMap (t => t.tyvars)).unique; } private var count = 0; @@ -113,7 +113,7 @@ object Programs { case class Clause(lhs: Term, rhs: List[Term]) { def tyvars = - (lhs.tyvars ::: (rhs flatMap (t => t.tyvars))).removeDuplicates; + (lhs.tyvars ::: (rhs flatMap (t => t.tyvars))).unique; def newInstance = { var s: Subst = List(); for (val a <- tyvars) { s = Binding(a, newVar(a)) :: s } diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index f12c234f74..b07e6b0e59 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -80,7 +80,7 @@ object Test extends Application { val tenPlus = ten map (_ + 1) assert((ten zip tenPlus) forall { case (x, y) => x + 1 == y }) val dble = ten flatMap (x => List(x, x)) - assert(dble.removeDuplicates == ten) + assert(dble.unique == ten) assert(ten.length == 10) assert(ten(0) == 1 && ten(9) == 10) assert((ten lengthCompare 10) == 0 && (ten lengthCompare 1) > 0 && (ten lengthCompare 11) < 0) @@ -122,7 +122,7 @@ object Test extends Application { assert((ten diff (ten filter (_ % 2 == 0))) == (ten filterNot (_ % 2 == 0))) assert((ten intersect ten) == ten) assert((ten intersect List(5)) == List(5)) - assert((ten ++ ten).removeDuplicates == ten) + assert((ten ++ ten).unique == ten) assert(ten.patch(3, List(4, 5, 6, 7), 4) == ten) assert(ten.patch(0, List(1, 2, 3), 9) == List(1, 2, 3, 10)) assert(empty.padTo(10, 7) == Array.fill(10)(7).toSeq) diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala index 3eacacb663..9ead89beb4 100644 --- a/test/files/run/hashCodeBoxesRunTime.scala +++ b/test/files/run/hashCodeBoxesRunTime.scala @@ -5,7 +5,7 @@ object Test import java.{ lang => jl } import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject } - def allSame[T](xs: List[T]) = assert(xs.removeDuplicates.size == 1, "failed: " + xs) + def allSame[T](xs: List[T]) = assert(xs.unique.size == 1, "failed: " + xs) def mkNumbers(x: Int): List[Number] = List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble) diff --git a/test/files/run/hashCodeDistribution.scala b/test/files/run/hashCodeDistribution.scala index dbb6e833bd..64cae398f1 100644 --- a/test/files/run/hashCodeDistribution.scala +++ b/test/files/run/hashCodeDistribution.scala @@ -8,7 +8,7 @@ object Test { val hashCodes = for (x <- 0 until COUNT; y <- 0 until COUNT) yield C(x,y).hashCode - val uniques = hashCodes.removeDuplicates + val uniques = hashCodes.unique val collisionRate = (totalCodes - uniques.size) * 1000 / totalCodes assert(collisionRate < 5, "Collision rate too high: %d / 1000".format(collisionRate)) diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala index 87ecd70a48..f08b0d0394 100644 --- a/test/files/scalacheck/list.scala +++ b/test/files/scalacheck/list.scala @@ -7,14 +7,14 @@ object Test extends Properties("List") { property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size } property("reverse") = forAll { (l1: List[Int]) => l1.reverse.reverse == l1 } - property("toSet") = forAll { (l1: List[Int]) => sorted(l1.toSet.toList) sameElements sorted(l1).removeDuplicates } + property("toSet") = forAll { (l1: List[Int]) => sorted(l1.toSet.toList) sameElements sorted(l1).unique } property("flatten") = forAll { (xxs: List[List[Int]]) => xxs.flatten.length == (xxs map (_.length) sum) } property("startsWith/take") = forAll { (xs: List[Int], count: Int) => xs startsWith (xs take count) } property("endsWith/takeRight") = forAll { (xs: List[Int], count: Int) => xs endsWith (xs takeRight count) } property("fill") = forAll(choose(1, 100)) { count => forAll { (x: Int) => val xs = List.fill(count)(x) - (xs.length == count) && (xs.removeDuplicates == List(x)) + (xs.length == count) && (xs.unique == List(x)) } } } |