Map和Set中常用的一些方法。
var jetset = Set("one","two") jetset += "three" println(jetset.contains("four")) println(jetset.contains("three")) jetset.foreach(arg => println(arg)) print(jetset.size) import scala.collection.mutable.Map val treasureMap = Map[Int,String]() treasureMap +=(1->"one") treasureMap +=(2->"two") treasureMap +=(3->"three") print(treasureMap(1))
时间: 2024-11-06 15:32:57