ScalaのMapとTuple
2510 ワード
// apply Map , Map , apply
val bigDatas = Map("Spark" -> 5, "Hadoop" -> 11)
val programingLanguage = scala.collection.mutable.Map("Scala" -> 13, "Java" -> 23)
programingLanguage("Scala") = 10
for((name, age)
val persons = scala.collection.mutable.SortedMap(("yaj", 28), ("yrz", 4),("xh", 30))
for((age, name)
val personsInformation2 = new scala.collection.mutable.LinkedHashMap[String, Int]
personsInformation2 += ("Scala" -> 13, "Java" -> 23, "Python" -> 10)
for((name, age) 13, "Java" -> 23)
personsInformation -= ("Scala")
for((name, age)
val info = ("yaj", "Spark", "30", "I LOVE SCALA!!!")
println(info._4)
完全な例は次のとおりです.
object HelloMapTuple {
def main(args: Array[String]): Unit = {
// apply Map , Map , apply
val bigDatas = Map("Spark" -> 5, "Hadoop" -> 11)
val programingLanguage = scala.collection.mutable.Map("Scala" -> 13, "Java" -> 23)
programingLanguage("Scala") = 10
for((name, age) 13, "Java" -> 23)
personsInformation -= ("Scala")
for((name, age) 13, "Java" -> 23, "Python" -> 10)
for((name, age)