大家好,
我正在用IDEA 15.0.4调试一个scala程序,奇怪的是,调试方式和运行方式产生的结果不同,运行方式下,控制台的输出为
[mw_shl_code=applescript,true]in
3
in
2
in
1
in[/mw_shl_code]
调试方式下,控制台的输出为
[mw_shl_code=applescript,true]in
3
in
2
in
2
in
1
in
1
in[/mw_shl_code]
scala程序的 内容如下
------- [mw_shl_code=applescript,true]import scala.collection.mutable.ArrayBuffer
object TestCase1{
def func(testtttt:Iterator[(Int,Long)]): Iterator[(Int,Long)]={
println("in")
val testtttt1=testtttt.flatmap{
case(item,count)=>
val newPrefix=item
println(count)
val a=Iterator.single((newPrefix,count))
func(a)
val c = a
c
}
testtttt1
}
def main(args: Array[String]){
val freqItems = ArrayBuffer((2,3L),(3,2L),(4,1L))
val testtttt = freqItems.toIterator
val result = func(testtttt)
val reer = result.toArray
}
}[/mw_shl_code]
|