`
cakin24
  • 浏览: 1420840 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Scala Range与Stream

阅读更多

一 Range

  1. scala>1 to 10
  2. res20: scala.collection.immutable.Range.Inclusive=Range1 to 10
  3. scala>1 to 10 by 2
  4. res21: scala.collection.immutable.Range= inexact Range1 to 10 by 2
  5. scala>(1 to 10).toList
  6. res22:List[Int]=List(1,2,3,4,5,6,7,8,9,10)
  7. scala>1 until 10
  8. res23: scala.collection.immutable.Range=Range1 until 10
二 Stream
  1. scala>1#::2 #::3 #::Stream.empty
  2. res24: scala.collection.immutable.Stream[Int]=Stream(1,?)
  3. scala> val stream =(1 to 100000).toStream
  4. stream: scala.collection.immutable.Stream[Int]=Stream(1,?)
  5. scala> stream.head
  6. res25:Int=1
  7. scala> stream.tail
  8. res26: scala.collection.immutable.Stream[Int]=Stream(2,?)
分享到:
评论

相关推荐

    Mastering.Apache.Spark.178397146

    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 ...

    Mastering Apache Spark(PACKT,2015)

    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 ...

    Mastering Apache Spark 2.x Scale your m l and d l systems with SparkML, DL4j and

    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 ...

    Mastering Apache Spark 2.x - Second Edition

    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 ...

    kafka流培训材料

    Apache Kafka是一个开源的分布式流处理平台,由LinkedIn公司采用Scala和Java编写,并于2011年首次开源。它主要用于构建实时数据管道和流应用程序,用于处理大量数据。其强大的流处理能力使其不仅仅是一个消息队列...

Global site tag (gtag.js) - Google Analytics