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

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

主站蜘蛛池模板: 广南县| 安吉县| 贵南县| 丰都县| 永年县| 徐闻县| 邢台市| 龙泉市| 贺兰县| 陆河县| 平安县| 博客| 温宿县| 体育| 泰州市| 遵义县| 罗平县| 淮安市| 镇平县| 高台县| 铜川市| 万盛区| 双流县| 永春县| 连云港市| 遵化市| 新闻| 浦县| 东至县| 青海省| 西平县| 栖霞市| 正定县| 丹寨县| 陕西省| 龙海市| 梧州市| 莎车县| 惠州市| 永仁县| 额尔古纳市|