// StockPriceFinder.scala
object StockPriceFinder {
def getTickersAndUnits() = {
val stockAndUnitsXML = scala.xml.XML.load("stocks.xml")
(Map[String, Int]() /: (stocksAndUnitsXML \ "symbol")) {
(map, symbolNode) =>
val ticker = (symbolNode \ "@ticker").toString
val units = (symbolNode \ "units").text.toInt
map ++ Map(ticker -> units)
}
}
}
val symbolAndUnits = StockPriceFinder.getTickersAndUnits
error: not found: value StockPriceFinder
import StockPriceFinder
// StockPriceFinder.scala
package org.xxx.yyy
//
test.scala--
您收到此邮件是因为您订阅了Google网上论坛上的“Scala中文社区”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到scalacn+u...@googlegroups.com。
要发帖到此群组,请发送电子邮件至sca...@googlegroups.com。
要查看更多选项,请访问https://groups.google.com/d/optout。