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);
/*(牛郎,织女)
(李亚鹏,王菲)
(张杰,谢娜)*/
}
}
欢迎关注我的公众号:小秋的博客
CSDN博客:https://blog.csdn.net/xiaoqiu_cr
github:https://github.com/crr121
联系邮箱:rongchen633@gmail.com
有什么问题可以给我留言噢~