Skip to content

Commit 31f460a

Browse files
zenos-leegenos-lee
authored andcommitted
The menu for korean is added to all documents in guides and overviews.
An overview index document is added.
1 parent d546dd2 commit 31f460a

File tree

77 files changed

+1221
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1221
-52
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
layout: overview-large
3+
title: 소개
4+
5+
disqus: true
6+
7+
partof: collections
8+
num: 1
9+
language: ko
10+
---
11+
12+
**Martin Odersky, and Lex Spoon**
13+
14+
In the eyes of many, the new collections framework is the most significant
15+
change in the Scala 2.8 release. Scala had collections before (and in fact the new
16+
framework is largely compatible with them). But it's only 2.8 that
17+
provides a common, uniform, and all-encompassing framework for
18+
collection types.
19+
20+
Even though the additions to collections are subtle at first glance,
21+
the changes they can provoke in your programming style can be
22+
profound. In fact, quite often it's as if you work on a higher-level
23+
with the basic building blocks of a program being whole collections
24+
instead of their elements. This new style of programming requires some
25+
adaptation. Fortunately, the adaptation is helped by several nice
26+
properties of the new Scala collections. They are easy to use,
27+
concise, safe, fast, universal.
28+
29+
**Easy to use:** A small vocabulary of 20-50 methods is
30+
enough to solve most collection problems in a couple of operations. No
31+
need to wrap your head around complicated looping structures or
32+
recursions. Persistent collections and side-effect-free operations mean
33+
that you need not worry about accidentally corrupting existing
34+
collections with new data. Interference between iterators and
35+
collection updates is eliminated.
36+
37+
**Concise:** You can achieve with a single word what used to
38+
take one or several loops. You can express functional operations with
39+
lightweight syntax and combine operations effortlessly, so that the result
40+
feels like a custom algebra.
41+
42+
**Safe:** This one has to be experienced to sink in. The
43+
statically typed and functional nature of Scala's collections means
44+
that the overwhelming majority of errors you might make are caught at
45+
compile-time. The reason is that (1) the collection operations
46+
themselves are heavily used and therefore well
47+
tested. (2) the usages of the collection operation make inputs and
48+
output explicit as function parameters and results. (3) These explicit
49+
inputs and outputs are subject to static type checking. The bottom line
50+
is that the large majority of misuses will manifest themselves as type
51+
errors. It's not at all uncommon to have programs of several hundred
52+
lines run at first try.
53+
54+
**Fast:** Collection operations are tuned and optimized in the
55+
libraries. As a result, using collections is typically quite
56+
efficient. You might be able to do a little bit better with carefully
57+
hand-tuned data structures and operations, but you might also do a lot
58+
worse by making some suboptimal implementation decisions along the
59+
way. What's more, collections have been recently adapted to parallel
60+
execution on multi-cores. Parallel collections support the same
61+
operations as sequential ones, so no new operations need to be learned
62+
and no code needs to be rewritten. You can turn a sequential collection into a
63+
parallel one simply by invoking the `par` method.
64+
65+
**Universal:** Collections provide the same operations on
66+
any type where it makes sense to do so. So you can achieve a lot with
67+
a fairly small vocabulary of operations. For instance, a string is
68+
conceptually a sequence of characters. Consequently, in Scala
69+
collections, strings support all sequence operations. The same holds
70+
for arrays.
71+
72+
**Example:** Here's one line of code that demonstrates many of the
73+
advantages of Scala's collections.
74+
75+
val (minors, adults) = people partition (_.age < 18)
76+
77+
It's immediately clear what this operation does: It partitions a
78+
collection of `people` into `minors` and `adults` depending on
79+
their age. Because the `partition` method is defined in the root
80+
collection type `TraversableLike`, this code works for any kind of
81+
collection, including arrays. The resulting `minors` and `adults`
82+
collections will be of the same type as the `people` collection.
83+
84+
This code is much more concise than the one to three loops required for
85+
traditional collection processing (three loops for an array, because
86+
the intermediate results need to be buffered somewhere else). Once
87+
you have learned the basic collection vocabulary you will also find
88+
writing this code is much easier and safer than writing explicit
89+
loops. Furthermore, the `partition` operation is quite fast, and will
90+
get even faster on parallel collections on multi-cores. (Parallel
91+
collections have been released
92+
as part of Scala 2.9.)
93+
94+
This document provides an in depth discussion of the APIs of the
95+
Scala collections classes from a user perspective. It takes you on
96+
a tour of all the fundamental classes and the methods they define.

0 commit comments

Comments
 (0)