随笔分类 -  Scala

摘要:集合高级计算 ( 1 )过滤 遍历一个集合并从中获取满足指定条件的元素组成一个新的集合 ( 2 ) 转化 / 映射( map ) 将集合中的每一个元素映射到某一个函数 ( 3 )扁平化 ( 4 )扁平化 + 映射 注: flatMap 相当于先进行 map 操作,在进行 flatten 操作集合中的 阅读全文
posted @ 2022-08-26 15:50 tootooquan 阅读(47) 评论(0) 推荐(0) 编辑
摘要:def 函数名称(参数列表):函数返回值类型={函数体} def looper(x: Long, y: Long): Long = { var a = x var b = y while (a != 0) { val temp = a a = b % a b = temp } //返回值 b } 若 阅读全文
posted @ 2022-05-29 17:59 tootooquan 阅读(85) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示