map 遍历 ListBuffer去重

var data= Map(0 -> ListBuffer[String]())

data.keys.foreach { i =>
      var count = 0
      xiangmuData(i).distinct.foreach(ever => {
        sql = "SELECT * FROM biao2 where rsid = " + ever
        val res = statement.executeQuery(sql)
        while (resRs.next()) {
          count += 1
        }
      })
      println(i + ":" + count)
    }
其中 distinct是用来将ListBuffer中重复的项去掉


你可能感兴趣的:(scala)