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

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.

主站蜘蛛池模板: 临潭县| 宁化县| 绥江县| 揭东县| 黄浦区| 威信县| 朔州市| 宁陵县| 虎林市| 田东县| 岳池县| 察隅县| 晋州市| 嫩江县| 扬中市| 永春县| 米泉市| 曲周县| 临沭县| 资源县| 镇远县| 剑川县| 武宣县| 田林县| 武宁县| 陈巴尔虎旗| 漠河县| 河东区| 白玉县| 武夷山市| 荔波县| 民丰县| 鄂州市| 海伦市| 佛冈县| 克什克腾旗| 澜沧| 通海县| 临安市| 云龙县| 军事|