官术网_书友最值得收藏!

  • Learn Scala Programming
  • Slava Schmidt
  • 239字
  • 2021-06-10 19:35:43

Summary

Scala 2.13 is a minor update of Scala with the main focus on the redesigned collection library. The few small additions to the standard library, such as automatic resource management, just accentuate this fact.

The new collection library mainly consists of two intermixed inheritance hierarchies with a similar shape. Members of the first hierarchy describe the structure of the collection and members of the second hierarchy—operations available on this collection type. Because of the inheritance relations, the collections situated lower in the tree define additional methods for more specific collections and override methods defined by the parent traits to provide more efficient implementation as required.

The three main collection types are Seq, Set, and Map. Each of these types has multiple implementations that are useful in specific situations. Set is also a function of one argument; Seq and Map are PartialFunctions.

Most of the collections are available in mutable and immutable forms.

In addition to the collection hierarchies, there is a concept of View, which is a reified definition of iterators’ operations and can be used to lazily apply transformations to the collection. Another related abstraction is IterableFactory, which implements some general ways to create collection instances and to perform conversions between collection representations.

In the next chapter, we will shift our focus from the new features of version 2.13 to a general exploration of Scala, starting with its type system.

主站蜘蛛池模板: 长乐市| 崇礼县| 乌拉特中旗| 虹口区| 东港市| 侯马市| 静乐县| 罗定市| 池州市| 吉林市| 修武县| 图木舒克市| 伽师县| 黎平县| 宽城| 台北市| 淮北市| 定南县| 永春县| 金阳县| 蓬莱市| 交口县| 巴彦县| 南京市| 舞阳县| 女性| 安阳县| 全椒县| 巩义市| 建平县| 玛沁县| 常德市| 平顺县| 九台市| 河南省| 德格县| 手游| 大足县| 富蕴县| 邹平县| 呼和浩特市|