Scala数组的拉链操作

1、两个数组的咬合操作(拉链操作)


    object helloworld {
      def main(args: Array[String]) {

       val husband = Array("牛郎","李亚鹏","张杰");
        val wife = Array("织女","王菲","谢娜");
        val both =  husband.zip(wife);
        println(husband);
        for(i<-both)println(i);
        /*(牛郎,织女)
        (李亚鹏,王菲)
        (张杰,谢娜)*/


  }
}

你可能感兴趣的:(scala)