@@ -12,22 +12,15 @@ num: 1
12
12
permalink : /overviews/collections-2.13/:title.html
13
13
---
14
14
15
- ** Martin Odersky, and Lex Spoon**
16
-
17
- In the eyes of many, the new collections framework is the most significant
18
- change in the Scala 2.8 release. Scala had collections before (and in fact the new
19
- framework is largely compatible with them). But it's only 2.8 that
20
- provides a common, uniform, and all-encompassing framework for
21
- collection types.
22
-
23
- Even though the additions to collections are subtle at first glance,
24
- the changes they can provoke in your programming style can be
25
- profound. In fact, quite often it's as if you work on a higher-level
26
- with the basic building blocks of a program being whole collections
27
- instead of their elements. This new style of programming requires some
28
- adaptation. Fortunately, the adaptation is helped by several nice
29
- properties of the new Scala collections. They are easy to use,
30
- concise, safe, fast, universal.
15
+ The collections framework is the heart of the Scala 2.13 standard
16
+ library. It provides a common, uniform, and all-encompassing
17
+ framework for collection types. This framework enables you to work
18
+ with data in memory at a high level, with the basic building blocks of
19
+ a program being whole collections, instead of individual elements.
20
+
21
+ This style of programming requires some learning. Fortunately,
22
+ the adaptation is helped by several nice properties of the Scala
23
+ collections. They are easy to use, concise, safe, fast, universal.
31
24
32
25
** Easy to use:** A small vocabulary of 20-50 methods is
33
26
enough to solve most collection problems in a couple of operations. No
@@ -40,7 +33,7 @@ collection updates is eliminated.
40
33
** Concise:** You can achieve with a single word what used to
41
34
take one or several loops. You can express functional operations with
42
35
lightweight syntax and combine operations effortlessly, so that the result
43
- feels like a custom algebra.
36
+ feels like a custom algebra.
44
37
45
38
** Safe:** This one has to be experienced to sink in. The
46
39
statically typed and functional nature of Scala's collections means
@@ -59,10 +52,13 @@ libraries. As a result, using collections is typically quite
59
52
efficient. You might be able to do a little bit better with carefully
60
53
hand-tuned data structures and operations, but you might also do a lot
61
54
worse by making some suboptimal implementation decisions along the
62
- way. What's more, collections have been recently adapted to parallel
63
- execution on multi-cores. Parallel collections support the same
64
- operations as sequential ones, so no new operations need to be learned
65
- and no code needs to be rewritten. You can turn a sequential collection into a
55
+ way.
56
+
57
+ ** Parallel** : The
58
+ [ ` scala-parallel-collections ` module] ( https://index.scala-lang.org/scala/scala-parallel-collections/scala-parallel-collections )
59
+ provides parallel execution of collections operations across multiple cores.
60
+ Parallel collections generally support the same
61
+ operations as sequential ones. You can turn a sequential collection into a
66
62
parallel one simply by invoking the ` par ` method.
67
63
68
64
** Universal:** Collections provide the same operations on
@@ -89,10 +85,10 @@ traditional collection processing (three loops for an array, because
89
85
the intermediate results need to be buffered somewhere else). Once
90
86
you have learned the basic collection vocabulary you will also find
91
87
writing this code is much easier and safer than writing explicit
92
- loops. Furthermore, the ` partition ` operation is quite fast, and can
93
- be even faster on parallel collections on multi-cores. (Parallel
94
- collections are available as a
95
- [ separate library ] ( https://index.scala-lang.org/scala/scala- parallel- collections/scala-parallel-collections ) )
88
+ loops.
89
+
90
+ Furthermore, the ` partition ` operation is quite fast, and can
91
+ be even faster on parallel collections on multiple cores.
96
92
97
93
This document provides an in depth discussion of the APIs of the
98
94
Scala collections classes from a user perspective. It takes you on
0 commit comments