8000 Merge pull request #450 from eed3si9n/topic/merge-280 · junbong/scala.github.com@0530527 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0530527

Browse files
committed
Merge pull request scala#450 from eed3si9n/topic/merge-280
Adds Chinese translation (Subsumes scala#280)
2 parents a4b18c8 + 89de7d6 commit 0530527

File tree

71 files changed

+5218
-26
lines changed

Some content is hidden

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

71 files changed

+5218
-26
lines changed

_layouts/guides-thanks.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
layout: index
3+
---
4+
5+
<div class="container">
6+
<div class="row">
7+
<div class="span10">
8+
{{ content }}
9+
</div>
10+
11+
</div>
12+
</div>

overviews/collections/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 10
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
[Array](http://www.scala-lang.org/api/{{ site.scala-version }}/scala/Array.html) is a special kind of collection in Scala. On the one hand, Scala arrays correspond one-to-one to Java arrays. That is, a Scala array `Array[Int]` is represented as a Java `int[]`, an `Array[Double]` is represented as a Java `double[]` and a `Array[String]` is represented as a Java `String[]`. But at the same time, Scala arrays offer much more than their Java analogues. First, Scala arrays can be _generic_. That is, you can have an `Array[T]`, where `T` is a type parameter or abstract type. Second, Scala arrays are compatible with Scala sequences - you can pass an `Array[T]` where a `Seq[T]` is required. Finally, Scala arrays also support all sequence operations. Here's an example of this in action:

overviews/collections/concrete-immutable-collection-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 8
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
Scala provides many concrete immutable collection classes for you to choose from. They differ in the traits they implement (maps, sets, sequences), whether they can be infinite, and the speed of various operations. Here are some of the most common immutable collection types used in Scala.

overviews/collections/concrete-mutable-collection-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 9
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
You've now seen the most commonly used immutable collection classes that Scala provides in its standard library. Take a look now at the mutable collection classes.

overviews/collections/conversions-between-java-and-scala-collections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 17
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
Like Scala, Java also has a rich collections library. There are many similarities between the two. For instance, both libraries know iterators, iterables, sets, maps, and sequences. But there are also important differences. In particular, the Scala libraries put much more emphasis on immutable collections, and provide many more operations that transform a collection into a new one.

overviews/collections/creating-collections-from-scratch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 16
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
You have syntax `List(1, 2, 3)` to create a list of three integers and `Map('A' -> 1, 'C' -> 2)` to create a map with two bindings. This is actually a universal feature of Scala collections. You can take any collection name and follow it by a list of elements in parentheses. The result will be a new collection with the given elements. Here are some more examples:

overviews/collections/equality.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 13
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
The collection libraries have a uniform approach to equality and hashing. The idea is, first, to divide collections into sets, maps, and sequences. Collections in different categories are always unequal. For instance, `Set(1, 2, 3)` is unequal to `List(1, 2, 3)` even though they contain the same elements. On the other hand, within the same category, collections are equal if and only if they have the same elements (for sequences: the same elements in the same order). For example, `List(1, 2, 3) == Vector(1, 2, 3)`, and `HashSet(1, 2) == TreeSet(2, 1)`.

overviews/collections/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ disqus: true
66

77
partof: collections
88
num: 1
9-
languages: [ja, pt-br]
9+
languages: [ja, zh-cn, pt-br]
1010
---
1111

1212
**Martin Odersky, and Lex Spoon**
13-
13+
1414
In the eyes of many, the new collections framework is the most significant
1515
change in the Scala 2.8 release. Scala had collections before (and in fact the new
1616
framework is largely compatible with them). But it's only 2.8 that

overviews/collections/iterators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 15
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
An iterator is not a collection, but rather a way to access the elements of a collection one by one. The two basic operations on an iterator `it` are `next` and `hasNext`. A call to `it.next()` will return the next element of the iterator and advance the state of the iterator. Calling `next` again on the same iterator will then yield the element one beyond the one returned previously. If there are no more elements to return, a call to `next` will throw a `NoSuchElementException`. You can find out whether there are more elements to return using [Iterator](http://www.scala-lang.org/api/{{ site.scala-version }}/scala/collection/Iterator.html)'s `hasNext` method.

overviews/collections/maps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ disqus: true
66

77
partof: collections
88
num: 7
9-
languages: [ja]
9+
languages: [ja, zh-cn]
1010
---
1111

1212
A [Map](http://www.scala-lang.org/api/current/scala/collection/Map.html) is an [Iterable](http://www.scala-lang.org/api/current/scala/collection/Iterable.html) consisting of pairs of keys and values (also named _mappings_ or _associations_). Scala's [Predef](http://www.scala-lang.org/api/current/scala/Predef$.html) class offers an implicit conversion that lets you write `key -> value` as an alternate syntax for the pair `(key, value)`. For instance `Map("x" -> 24, "y" -> 25, "z" -> 26)` means exactly the same as `Map(("x", 24), ("y", 25), ("z", 26))`, but reads better.

0 commit comments

Comments
 (0)
0