scala 编程思想 --数据
package com.test2 import scala.util.Try object Zipper { def main(args: Array[String]): Unit = { //zip进行数据压缩 val left = Vector("a","b","c","d") val right = Vector("q","r","s","t") println(left.zip(right)) println(left.zip(Range(0,4))) println(left.zipWithIndex) //zipMap case class Person(name:String,ID:Int) val names = Vector("Bob","Jill","Jim") val IDs = Vector(1731,9234,8378) names.zip(IDs).map{case(n,id)=>Person(n,id)} //scala中case的用法 val bools = List(true,false) for(bool<-bools){ bool match { case true=>println("heads") case false=>println("tails") case _=>println("somthing other than heads