项目作者: evolution-gaming
项目描述 :
Stream
高级语言: Scala
项目地址: git://github.com/evolution-gaming/sstream.git
SStream





Use case examples
test("take") {
Stream[Id].many(1, 2, 3).take(1).toList shouldEqual List(1)
}
test("first") {
Stream[Id].single(0).first shouldEqual Some(0)
}
test("repeat") {
Stream.repeat[Id, Int](0).take(3).length shouldEqual 3
}
test("collect") {
Stream[Id].many(1, 2, 3).collect { case x if x >= 2 => x + 1 }.toList shouldEqual List(3, 4)
}
test("zipWithIndex") {
Stream.repeat[Id, Int](0).zipWithIndex.take(3).toList shouldEqual List((0, 0), (0, 1), (0, 2))
}
Setup
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")
libraryDependencies += "com.evolutiongaming" %% "sstream" % "0.2.1"