summaryrefslogtreecommitdiff
path: root/test/files/run/json.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-15 20:48:25 +0000
committerPaul Phillips <paulp@improving.org>2011-08-15 20:48:25 +0000
commit20859263f2a2cf85464b333b9842bb31c020ee5e (patch)
tree8a315ae89a7a3bf1093dd4c62dffa7c188c785fc /test/files/run/json.scala
parente43daf434becf4497acb4d297ab6d2866c16d1aa (diff)
downloadscala-20859263f2a2cf85464b333b9842bb31c020ee5e.tar.gz
scala-20859263f2a2cf85464b333b9842bb31c020ee5e.tar.bz2
scala-20859263f2a2cf85464b333b9842bb31c020ee5e.zip
Removing the code which has been deprecated sin...
Removing the code which has been deprecated since 2.8.0. Contributed by Simon Ochsenreither, although deleting code is such fun one hesitates to call it a contribution. Still, we will. Closes SI-4860, no review.
Diffstat (limited to 'test/files/run/json.scala')
-rw-r--r--test/files/run/json.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/files/run/json.scala b/test/files/run/json.scala
index 7b2b80718c..8ee8c347fd 100644
--- a/test/files/run/json.scala
+++ b/test/files/run/json.scala
@@ -7,8 +7,8 @@ object Test extends App {
* toString comparison. */
def jsonToString(in : Any) : String = in match {
case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]"
- case m : Map[String,_] => "{" + m.elements.toList
- .sort({ (x,y) => x._1 < y._1 })
+ case m : Map[String,_] => "{" + m.iterator.toList
+ .sortWith({ (x,y) => x._1 < y._1 })
.map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) })
.mkString(", ") + "}"
case s : String => "\"" + s + "\""
@@ -20,7 +20,7 @@ object Test extends App {
*/
def sortJSON(in : Any) : Any = in match {
case l : List[_] => l.map(sortJSON)
- case m : Map[String,_] => TreeMap(m.mapElements(sortJSON).elements.toSeq : _*)
+ case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*)
// For the object versions, sort their contents, ugly casts and all...
case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]])
case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]])
@@ -62,7 +62,7 @@ object Test extends App {
def stringDiff (expected : String, actual : String) {
if (expected != actual) {
// Figure out where the Strings differ and generate a marker
- val mismatchPosition = expected.toList.zip(actual.toList).findIndexOf({case (x,y) => x != y}) match {
+ val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match {
case -1 => Math.min(expected.length, actual.length)
case x => x
}