diff options
-rw-r--r-- | sources/examples/iterators.scala | 3 | ||||
-rw-r--r-- | sources/examples/sort.scala | 5 |
2 files changed, 3 insertions, 5 deletions
diff --git a/sources/examples/iterators.scala b/sources/examples/iterators.scala index 7936e413da..3f2ddbb0be 100644 --- a/sources/examples/iterators.scala +++ b/sources/examples/iterators.scala @@ -12,8 +12,7 @@ object iterators { .map{case Pair(x, i) => i} def main(args: Array[String]) = { - val xs: List[Double] = List(6, 2, 8, 5, 1); - val ar = xs.copyToArray(new Array[Double](xs.length), 0); + val ar = Array[Double](6, 2, 8, 5, 1); printArray(ar); Console.println("Elements greater than 3.0:"); findGreater(ar, 3.0) foreach { x => Console.println(ar(x)); } diff --git a/sources/examples/sort.scala b/sources/examples/sort.scala index 2c3c3666a5..38a9755774 100644 --- a/sources/examples/sort.scala +++ b/sources/examples/sort.scala @@ -34,12 +34,11 @@ object sorter { ar(i) + (if (i < ar.length-1) "," + iter(i+1) else ""); if (ar.length == 0) "" else iter(0) } - Console.println("[" + print1 + "]"); + Console.println("[" + print1 + "]") } def main(args: Array[String]) = { - val xs = List(6, 2, 8, 5, 1); - val ar = xs.copyToArray(new Array[Int](xs.length), 0); + val ar = Array(6, 2, 8, 5, 1); println(ar); sort(ar); println(ar) |