摘要: result: List(2, 4, a, b) List(2, 4, List(a, b)) flatMap就是在Map的基础上加了压平flatten的功能 foldLeft 从左边起折叠,累加 https://alvinalexander.com/scala/scala-reduceleft-e 阅读全文
posted @ 2017-08-07 23:05 牵牛花 阅读(552) 评论(0) 推荐(0)
摘要: package my.bigdata.scala08import scala.collection.mutableimport scala.collection.mutable.ArrayBufferimport scala.io.Source/** scala word count * Created by lq on 2017/8/7. */object Task2 { /** ... 阅读全文
posted @ 2017-08-07 22:36 牵牛花 阅读(302) 评论(0) 推荐(0)
摘要: val data2Mysql2 = (iterator: Iterator[(String, Int)]) => { var conn: Connection = null; var ps: PreparedStatement = null val sql = "Insert into location_info(location,counts,accesse_date)... 阅读全文
posted @ 2017-08-07 10:12 牵牛花 阅读(263) 评论(0) 推荐(0)
摘要: class NetworkUtilTest extends FunSuite with Matchers { test("testIp2Int") { val ip = NetworkUtil.ip2Int("192.168.120.60") ip should be(1014540480) }} org.scalatest ... 阅读全文
posted @ 2017-08-07 09:43 牵牛花 阅读(506) 评论(0) 推荐(0)