一 Range
scala>1 to 10
res20: scala.collection.immutable.Range.Inclusive=Range1 to 10
scala>1 to 10 by 2
res21: scala.collection.immutable.Range= inexact Range1 to 10 by 2
scala>(1 to 10).toList
res22:List[Int]=List(1,2,3,4,5,6,7,8,9,10)
scala>1 until 10
res23: scala.collection.immutable.Range=Range1 until 10
二 Stream
- scala>1#::2 #::3 #::Stream.empty
res24: scala.collection.immutable.Stream[Int]=Stream(1,?)
scala> val stream =(1 to 100000).toStream
stream: scala.collection.immutable.Stream[Int]=Stream(1,?)
scala> stream.head
res25:Int=1
scala> stream.tail
res26: scala.collection.immutable.Stream[Int]=Stream(2,?)
相关推荐
Apache Spark is an in-memory cluster based parallel processing system that provides a wide range of functionality like graph processing, machine learning, stream processing and SQL. It operates at ...
Apache Spark is an in-memory cluster based parallel processing system that provides a wide range of functionality like graph processing, machine learning, stream processing and SQL. It operates at ...
Apache Spark is an in-memory cluster-based parallel processing system that provides a wide range of functionalities such as graph processing, machine learning, stream processing, and SQL. This book ...
Apache Spark is an in-memory cluster-based parallel processing system that provides a wide range of functionalities such as graph processing, machine learning, stream processing, and SQL. This book ...
Apache Kafka是一个开源的分布式流处理平台,由LinkedIn公司采用Scala和Java编写,并于2011年首次开源。它主要用于构建实时数据管道和流应用程序,用于处理大量数据。其强大的流处理能力使其不仅仅是一个消息队列...