From f3cde7e6ee36b56b1d9af7c2a13622b8f00ccc48 Mon Sep 17 00:00:00 2001 From: exoego Date: Mon, 22 Jul 2019 13:44:52 +0900 Subject: [PATCH 1/4] Mark older Overviews/Collections --- _overviews/collections/arrays.md | 2 +- _overviews/collections/concrete-immutable-collection-classes.md | 2 +- _overviews/collections/concrete-mutable-collection-classes.md | 2 +- .../conversions-between-java-and-scala-collections.md | 2 +- _overviews/collections/creating-collections-from-scratch.md | 2 +- _overviews/collections/equality.md | 2 +- _overviews/collections/introduction.md | 2 +- _overviews/collections/iterators.md | 2 +- _overviews/collections/maps.md | 2 +- _overviews/collections/migrating-from-scala-27.md | 2 +- _overviews/collections/overview.md | 2 +- _overviews/collections/performance-characteristics.md | 2 +- _overviews/collections/seqs.md | 2 +- _overviews/collections/sets.md | 2 +- _overviews/collections/strings.md | 2 +- _overviews/collections/trait-iterable.md | 2 +- _overviews/collections/trait-traversable.md | 2 +- _overviews/collections/views.md | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/_overviews/collections/arrays.md b/_overviews/collections/arrays.md index 343ebb1c74..bce565ea14 100644 --- a/_overviews/collections/arrays.md +++ b/_overviews/collections/arrays.md @@ -5,7 +5,7 @@ title: Arrays discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 10 diff --git a/_overviews/collections/concrete-immutable-collection-classes.md b/_overviews/collections/concrete-immutable-collection-classes.md index b0e16eceb7..3f1fad4378 100644 --- a/_overviews/collections/concrete-immutable-collection-classes.md +++ b/_overviews/collections/concrete-immutable-collection-classes.md @@ -5,7 +5,7 @@ title: Concrete Immutable Collection Classes discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 8 diff --git a/_overviews/collections/concrete-mutable-collection-classes.md b/_overviews/collections/concrete-mutable-collection-classes.md index 432eb6df9f..2e7e94e988 100644 --- a/_overviews/collections/concrete-mutable-collection-classes.md +++ b/_overviews/collections/concrete-mutable-collection-classes.md @@ -5,7 +5,7 @@ title: Concrete Mutable Collection Classes discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 9 diff --git a/_overviews/collections/conversions-between-java-and-scala-collections.md b/_overviews/collections/conversions-between-java-and-scala-collections.md index 7d1f3d150a..7c7323125c 100644 --- a/_overviews/collections/conversions-between-java-and-scala-collections.md +++ b/_overviews/collections/conversions-between-java-and-scala-collections.md @@ -5,7 +5,7 @@ title: Conversions Between Java and Scala Collections discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 17 diff --git a/_overviews/collections/creating-collections-from-scratch.md b/_overviews/collections/creating-collections-from-scratch.md index cdff42e054..d21c13d710 100644 --- a/_overviews/collections/creating-collections-from-scratch.md +++ b/_overviews/collections/creating-collections-from-scratch.md @@ -5,7 +5,7 @@ title: Creating Collections From Scratch discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 16 diff --git a/_overviews/collections/equality.md b/_overviews/collections/equality.md index 0e41a5ccd9..08a8d110eb 100644 --- a/_overviews/collections/equality.md +++ b/_overviews/collections/equality.md @@ -5,7 +5,7 @@ title: Equality discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 13 diff --git a/_overviews/collections/introduction.md b/_overviews/collections/introduction.md index e026efafaa..c480affa85 100644 --- a/_overviews/collections/introduction.md +++ b/_overviews/collections/introduction.md @@ -5,7 +5,7 @@ title: Introduction discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 1 diff --git a/_overviews/collections/iterators.md b/_overviews/collections/iterators.md index 975824d498..02a41f1ed0 100644 --- a/_overviews/collections/iterators.md +++ b/_overviews/collections/iterators.md @@ -5,7 +5,7 @@ title: Iterators discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 15 diff --git a/_overviews/collections/maps.md b/_overviews/collections/maps.md index 89a0663914..d7291dc6cb 100644 --- a/_overviews/collections/maps.md +++ b/_overviews/collections/maps.md @@ -5,7 +5,7 @@ title: Maps discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 7 diff --git a/_overviews/collections/migrating-from-scala-27.md b/_overviews/collections/migrating-from-scala-27.md index 87f557ca4f..939ef0987c 100644 --- a/_overviews/collections/migrating-from-scala-27.md +++ b/_overviews/collections/migrating-from-scala-27.md @@ -5,7 +5,7 @@ title: Migrating from Scala 2.7 discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 18 diff --git a/_overviews/collections/overview.md b/_overviews/collections/overview.md index 41bdf6ff39..b4c73e0567 100644 --- a/_overviews/collections/overview.md +++ b/_overviews/collections/overview.md @@ -5,7 +5,7 @@ title: Mutable and Immutable Collections discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 2 diff --git a/_overviews/collections/performance-characteristics.md b/_overviews/collections/performance-characteristics.md index c43aeabb68..e6e1e92537 100644 --- a/_overviews/collections/performance-characteristics.md +++ b/_overviews/collections/performance-characteristics.md @@ -5,7 +5,7 @@ title: Performance Characteristics discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 12 diff --git a/_overviews/collections/seqs.md b/_overviews/collections/seqs.md index 3e12de6fc1..a932a8ce4b 100644 --- a/_overviews/collections/seqs.md +++ b/_overviews/collections/seqs.md @@ -5,7 +5,7 @@ title: The sequence traits Seq, IndexedSeq, and LinearSeq discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 5 diff --git a/_overviews/collections/sets.md b/_overviews/collections/sets.md index 4b06a0501f..d93a03acad 100644 --- a/_overviews/collections/sets.md +++ b/_overviews/collections/sets.md @@ -5,7 +5,7 @@ title: Sets discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 6 diff --git a/_overviews/collections/strings.md b/_overviews/collections/strings.md index b1729328de..058fb8b281 100644 --- a/_overviews/collections/strings.md +++ b/_overviews/collections/strings.md @@ -5,7 +5,7 @@ title: Strings discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 11 diff --git a/_overviews/collections/trait-iterable.md b/_overviews/collections/trait-iterable.md index e478f3d4d7..f8f0bf7763 100644 --- a/_overviews/collections/trait-iterable.md +++ b/_overviews/collections/trait-iterable.md @@ -5,7 +5,7 @@ title: Trait Iterable discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 4 diff --git a/_overviews/collections/trait-traversable.md b/_overviews/collections/trait-traversable.md index fe048347ec..a954246f99 100644 --- a/_overviews/collections/trait-traversable.md +++ b/_overviews/collections/trait-traversable.md @@ -5,7 +5,7 @@ title: Trait Traversable discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 3 diff --git a/_overviews/collections/views.md b/_overviews/collections/views.md index 09e5b8f7ff..2a7f90c929 100644 --- a/_overviews/collections/views.md +++ b/_overviews/collections/views.md @@ -5,7 +5,7 @@ title: Views discourse: true partof: collections -overview-name: Collections +overview-name: Collections (Scala 2.8 - 2.12) num: 14 From 06213510180fc9c12d9163d5498127095ceb5195 Mon Sep 17 00:00:00 2001 From: exoego Date: Mon, 22 Jul 2019 13:45:23 +0900 Subject: [PATCH 2/4] Add a link to newer version of collections. --- _overviews/collections/arrays.md | 5 +++++ .../collections/concrete-immutable-collection-classes.md | 5 +++++ .../collections/concrete-mutable-collection-classes.md | 5 +++++ .../conversions-between-java-and-scala-collections.md | 5 +++++ _overviews/collections/creating-collections-from-scratch.md | 5 +++++ _overviews/collections/equality.md | 5 +++++ _overviews/collections/introduction.md | 5 +++++ _overviews/collections/iterators.md | 5 +++++ _overviews/collections/maps.md | 5 +++++ _overviews/collections/migrating-from-scala-27.md | 5 +++++ _overviews/collections/overview.md | 5 +++++ _overviews/collections/performance-characteristics.md | 5 +++++ _overviews/collections/seqs.md | 5 +++++ _overviews/collections/sets.md | 5 +++++ _overviews/collections/strings.md | 5 +++++ _overviews/collections/trait-iterable.md | 5 +++++ _overviews/collections/trait-traversable.md | 5 +++++ _overviews/collections/views.md | 6 ++++++ _sass/layout/documentation.scss | 5 +++++ 19 files changed, 96 insertions(+) diff --git a/_overviews/collections/arrays.md b/_overviews/collections/arrays.md index bce565ea14..382af6a839 100644 --- a/_overviews/collections/arrays.md +++ b/_overviews/collections/arrays.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + [Array](http://www.scala-lang.org/api/{{ site.scala-212-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: scala> val a1 = Array(1, 2, 3) diff --git a/_overviews/collections/concrete-immutable-collection-classes.md b/_overviews/collections/concrete-immutable-collection-classes.md index 3f1fad4378..8e7e74d6f8 100644 --- a/_overviews/collections/concrete-immutable-collection-classes.md +++ b/_overviews/collections/concrete-immutable-collection-classes.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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. ## Lists diff --git a/_overviews/collections/concrete-mutable-collection-classes.md b/_overviews/collections/concrete-mutable-collection-classes.md index 2e7e94e988..404a1715ee 100644 --- a/_overviews/collections/concrete-mutable-collection-classes.md +++ b/_overviews/collections/concrete-mutable-collection-classes.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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. ## Array Buffers diff --git a/_overviews/collections/conversions-between-java-and-scala-collections.md b/_overviews/collections/conversions-between-java-and-scala-collections.md index 7c7323125c..cb9675fae0 100644 --- a/_overviews/collections/conversions-between-java-and-scala-collections.md +++ b/_overviews/collections/conversions-between-java-and-scala-collections.md @@ -13,6 +13,11 @@ languages: [zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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. Sometimes you might need to pass from one collection framework to the other. For instance, you might want to access an existing Java collection as if it were a Scala collection. Or you might want to pass one of Scala's collections to a Java method that expects its Java counterpart. It is quite easy to do this, because Scala offers implicit conversions between all the major collection types in the [JavaConverters](http://www.scala-lang.org/api/{{ site.scala-212-version }}/scala/collection/JavaConverters$.html) object. In particular, you will find bidirectional conversions between the following types. diff --git a/_overviews/collections/creating-collections-from-scratch.md b/_overviews/collections/creating-collections-from-scratch.md index d21c13d710..22c07d2016 100644 --- a/_overviews/collections/creating-collections-from-scratch.md +++ b/_overviews/collections/creating-collections-from-scratch.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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: Traversable() // An empty traversable object diff --git a/_overviews/collections/equality.md b/_overviews/collections/equality.md index 08a8d110eb..1bded6008e 100644 --- a/_overviews/collections/equality.md +++ b/_overviews/collections/equality.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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)`. It does not matter for the equality check whether a collection is mutable or immutable. For a mutable collection one simply considers its current elements at the time the equality test is performed. This means that a mutable collection might be equal to different collections at different times, depending what elements are added or removed. This is a potential trap when using a mutable collection as a key in a hashmap. Example: diff --git a/_overviews/collections/introduction.md b/_overviews/collections/introduction.md index c480affa85..23136be5ec 100644 --- a/_overviews/collections/introduction.md +++ b/_overviews/collections/introduction.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn, ru] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + **Martin Odersky, and Lex Spoon** In the eyes of many, the new collections framework is the most significant diff --git a/_overviews/collections/iterators.md b/_overviews/collections/iterators.md index 02a41f1ed0..c273f87c12 100644 --- a/_overviews/collections/iterators.md +++ b/_overviews/collections/iterators.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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-212-version }}/scala/collection/Iterator.html)'s `hasNext` method. The most straightforward way to "step through" all the elements returned by an iterator `it` uses a while-loop: diff --git a/_overviews/collections/maps.md b/_overviews/collections/maps.md index d7291dc6cb..6ba3b480b4 100644 --- a/_overviews/collections/maps.md +++ b/_overviews/collections/maps.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + 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) object 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. The fundamental operations on maps are similar to those on sets. They are summarized in the following table and fall into the following categories: diff --git a/_overviews/collections/migrating-from-scala-27.md b/_overviews/collections/migrating-from-scala-27.md index 939ef0987c..56760c67f9 100644 --- a/_overviews/collections/migrating-from-scala-27.md +++ b/_overviews/collections/migrating-from-scala-27.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + Porting your existing Scala applications to use the new collections should be almost automatic. There are only a couple of possible issues to take care of. Generally, the old functionality of Scala 2.7 collections has been left in place. Some features have been deprecated, which means they will removed in some future release. You will get a _deprecation warning_ when you compile code that makes use of these features in Scala 2.8. In a few places deprecation was unfeasible, because the operation in question was retained in 2.8, but changed in meaning or performance characteristics. These cases will be flagged with _migration warnings_ when compiled under 2.8. To get full deprecation and migration warnings with suggestions how to change your code, pass the `-deprecation` and `-Xmigration` flags to `scalac` (note that `-Xmigration` is an extended option, so it starts with an `X`). You can also pass the same options to the `scala` REPL to get the warnings in an interactive session. Example: diff --git a/_overviews/collections/overview.md b/_overviews/collections/overview.md index b4c73e0567..cc46a849ba 100644 --- a/_overviews/collections/overview.md +++ b/_overviews/collections/overview.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + Scala collections systematically distinguish between mutable and immutable collections. A _mutable_ collection can be updated or extended in place. This means you can change, add, or remove elements diff --git a/_overviews/collections/performance-characteristics.md b/_overviews/collections/performance-characteristics.md index e6e1e92537..96cbacbe59 100644 --- a/_overviews/collections/performance-characteristics.md +++ b/_overviews/collections/performance-characteristics.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + The previous explanations have made it clear that different collection types have different performance characteristics. That's often the primary reason for picking one collection type over another. You can see the performance characteristics of some common operations on collections summarized in the following two tables. Performance characteristics of sequence types: diff --git a/_overviews/collections/seqs.md b/_overviews/collections/seqs.md index a932a8ce4b..17aa7f708b 100644 --- a/_overviews/collections/seqs.md +++ b/_overviews/collections/seqs.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + The [Seq](http://www.scala-lang.org/api/current/scala/collection/Seq.html) trait represents sequences. A sequence is a kind of iterable that has a `length` and whose elements have fixed index positions, starting from `0`. The operations on sequences, summarized in the table below, fall into the following categories: diff --git a/_overviews/collections/sets.md b/_overviews/collections/sets.md index d93a03acad..85d21f3c28 100644 --- a/_overviews/collections/sets.md +++ b/_overviews/collections/sets.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + `Set`s are `Iterable`s that contain no duplicate elements. The operations on sets are summarized in the following table for general sets and in the table after that for mutable sets. They fall into the following categories: * **Tests** `contains`, `apply`, `subsetOf`. The `contains` method asks whether a set contains a given element. The `apply` method for a set is the same as `contains`, so `set(elem)` is the same as `set contains elem`. That means sets can also be used as test functions that return true for the elements they contain. diff --git a/_overviews/collections/strings.md b/_overviews/collections/strings.md index 058fb8b281..a6545dbf6a 100644 --- a/_overviews/collections/strings.md +++ b/_overviews/collections/strings.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + Like arrays, strings are not directly sequences, but they can be converted to them, and they also support all sequence operations on strings. Here are some examples of operations you can invoke on strings. scala> val str = "hello" diff --git a/_overviews/collections/trait-iterable.md b/_overviews/collections/trait-iterable.md index f8f0bf7763..b708c251f5 100644 --- a/_overviews/collections/trait-iterable.md +++ b/_overviews/collections/trait-iterable.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + The next trait from the top in the collections hierarchy is `Iterable`. All methods in this trait are defined in terms of an abstract method, `iterator`, which yields the collection's elements one by one. The `foreach` method from trait `Traversable` is implemented in `Iterable` in terms of `iterator`. Here is the actual implementation: def foreach[U](f: Elem => U): Unit = { diff --git a/_overviews/collections/trait-traversable.md b/_overviews/collections/trait-traversable.md index a954246f99..010a74fedb 100644 --- a/_overviews/collections/trait-traversable.md +++ b/_overviews/collections/trait-traversable.md @@ -13,6 +13,11 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + At the top of the collection hierarchy is trait `Traversable`. Its only abstract operation is `foreach`: def foreach[U](f: Elem => U) diff --git a/_overviews/collections/views.md b/_overviews/collections/views.md index 2a7f90c929..4968547708 100644 --- a/_overviews/collections/views.md +++ b/_overviews/collections/views.md @@ -13,6 +13,12 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- + + See this in Scala 2.13 + + + Collections have quite a few methods that construct new collections. Examples are `map`, `filter` or `++`. We call such methods transformers because they take at least one collection as their receiver object and produce another collection as their result. There are two principal ways to implement transformers. One is _strict_, that is a new collection with all its elements is constructed as a result of the transformer. The other is non-strict or _lazy_, that is one constructs only a proxy for the result collection, and its elements get constructed only as one demands them. diff --git a/_sass/layout/documentation.scss b/_sass/layout/documentation.scss index 9a04495b27..c9c121e9a6 100644 --- a/_sass/layout/documentation.scss +++ b/_sass/layout/documentation.scss @@ -57,3 +57,8 @@ padding: 1px 5px; } } + +.link-to-newer-version { + float: right; + padding: 0 0 1em 1em; +} From a22c2b648225d06cbb394f38348b4b65d5ac4d34 Mon Sep 17 00:00:00 2001 From: exoego Date: Mon, 22 Jul 2019 14:21:32 +0900 Subject: [PATCH 3/4] There is no newer version for those 2 pages. --- _overviews/collections/migrating-from-scala-27.md | 5 ----- _overviews/collections/trait-traversable.md | 5 ----- 2 files changed, 10 deletions(-) diff --git a/_overviews/collections/migrating-from-scala-27.md b/_overviews/collections/migrating-from-scala-27.md index 56760c67f9..939ef0987c 100644 --- a/_overviews/collections/migrating-from-scala-27.md +++ b/_overviews/collections/migrating-from-scala-27.md @@ -13,11 +13,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - Porting your existing Scala applications to use the new collections should be almost automatic. There are only a couple of possible issues to take care of. Generally, the old functionality of Scala 2.7 collections has been left in place. Some features have been deprecated, which means they will removed in some future release. You will get a _deprecation warning_ when you compile code that makes use of these features in Scala 2.8. In a few places deprecation was unfeasible, because the operation in question was retained in 2.8, but changed in meaning or performance characteristics. These cases will be flagged with _migration warnings_ when compiled under 2.8. To get full deprecation and migration warnings with suggestions how to change your code, pass the `-deprecation` and `-Xmigration` flags to `scalac` (note that `-Xmigration` is an extended option, so it starts with an `X`). You can also pass the same options to the `scala` REPL to get the warnings in an interactive session. Example: diff --git a/_overviews/collections/trait-traversable.md b/_overviews/collections/trait-traversable.md index 010a74fedb..a954246f99 100644 --- a/_overviews/collections/trait-traversable.md +++ b/_overviews/collections/trait-traversable.md @@ -13,11 +13,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - At the top of the collection hierarchy is trait `Traversable`. Its only abstract operation is `foreach`: def foreach[U](f: Elem => U) From 843382f1f35a79250803d704612226cbb2a5f467 Mon Sep 17 00:00:00 2001 From: exoego Date: Tue, 23 Jul 2019 12:13:52 +0900 Subject: [PATCH 4/4] Add newer version notice --- _layouts/inner-page-parent-dropdown.html | 1 + _layouts/inner-page-parent.html | 4 ++-- _overviews/collections/arrays.md | 6 +----- .../collections/concrete-immutable-collection-classes.md | 6 +----- .../collections/concrete-mutable-collection-classes.md | 6 +----- .../conversions-between-java-and-scala-collections.md | 6 +----- .../collections/creating-collections-from-scratch.md | 6 +----- _overviews/collections/equality.md | 6 +----- _overviews/collections/introduction.md | 6 +----- _overviews/collections/iterators.md | 6 +----- _overviews/collections/maps.md | 6 +----- _overviews/collections/overview.md | 6 +----- _overviews/collections/performance-characteristics.md | 6 +----- _overviews/collections/seqs.md | 6 +----- _overviews/collections/sets.md | 6 +----- _overviews/collections/strings.md | 6 +----- _overviews/collections/trait-iterable.md | 6 +----- _overviews/collections/views.md | 7 +------ _sass/layout/documentation.scss | 8 +++++--- 19 files changed, 24 insertions(+), 86 deletions(-) diff --git a/_layouts/inner-page-parent-dropdown.html b/_layouts/inner-page-parent-dropdown.html index d2e5029f68..5b89d3ef47 100644 --- a/_layouts/inner-page-parent-dropdown.html +++ b/_layouts/inner-page-parent-dropdown.html @@ -1,5 +1,6 @@ {% include headertop.html %} {% include headerbottom.html %} +{% if page.new-version %}This page has a new version.{% endif %} diff --git a/_layouts/inner-page-parent.html b/_layouts/inner-page-parent.html index 3ed25753ca..2dc28bb539 100644 --- a/_layouts/inner-page-parent.html +++ b/_layouts/inner-page-parent.html @@ -1,4 +1,5 @@ {% include headertop.html %} {% include headerbottom.html %} + {% if page.new-version %}This page has a new version.{% endif %} @@ -20,7 +21,6 @@

{{page.title}}

- @@ -28,4 +28,4 @@

{{page.title}}

-{% include footer.html %} \ No newline at end of file +{% include footer.html %} diff --git a/_overviews/collections/arrays.md b/_overviews/collections/arrays.md index 382af6a839..74af34c41a 100644 --- a/_overviews/collections/arrays.md +++ b/_overviews/collections/arrays.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/arrays.html num: 10 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - [Array](http://www.scala-lang.org/api/{{ site.scala-212-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: scala> val a1 = Array(1, 2, 3) diff --git a/_overviews/collections/concrete-immutable-collection-classes.md b/_overviews/collections/concrete-immutable-collection-classes.md index 8e7e74d6f8..f18caed726 100644 --- a/_overviews/collections/concrete-immutable-collection-classes.md +++ b/_overviews/collections/concrete-immutable-collection-classes.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/concrete-immutable-collection-classes.html num: 8 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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. ## Lists diff --git a/_overviews/collections/concrete-mutable-collection-classes.md b/_overviews/collections/concrete-mutable-collection-classes.md index 404a1715ee..c54343554d 100644 --- a/_overviews/collections/concrete-mutable-collection-classes.md +++ b/_overviews/collections/concrete-mutable-collection-classes.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/concrete-mutable-collection-classes.html num: 9 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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. ## Array Buffers diff --git a/_overviews/collections/conversions-between-java-and-scala-collections.md b/_overviews/collections/conversions-between-java-and-scala-collections.md index cb9675fae0..290726fdab 100644 --- a/_overviews/collections/conversions-between-java-and-scala-collections.md +++ b/_overviews/collections/conversions-between-java-and-scala-collections.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/conversions-between-java-and-scala-collections.html num: 17 @@ -13,11 +14,6 @@ languages: [zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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. Sometimes you might need to pass from one collection framework to the other. For instance, you might want to access an existing Java collection as if it were a Scala collection. Or you might want to pass one of Scala's collections to a Java method that expects its Java counterpart. It is quite easy to do this, because Scala offers implicit conversions between all the major collection types in the [JavaConverters](http://www.scala-lang.org/api/{{ site.scala-212-version }}/scala/collection/JavaConverters$.html) object. In particular, you will find bidirectional conversions between the following types. diff --git a/_overviews/collections/creating-collections-from-scratch.md b/_overviews/collections/creating-collections-from-scratch.md index 22c07d2016..1732a844e6 100644 --- a/_overviews/collections/creating-collections-from-scratch.md +++ b/_overviews/collections/creating-collections-from-scratch.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/creating-collections-from-scratch.html num: 16 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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: Traversable() // An empty traversable object diff --git a/_overviews/collections/equality.md b/_overviews/collections/equality.md index 1bded6008e..e368d64b35 100644 --- a/_overviews/collections/equality.md +++ b/_overviews/collections/equality.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/creating-collections-from-scratch.html num: 13 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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)`. It does not matter for the equality check whether a collection is mutable or immutable. For a mutable collection one simply considers its current elements at the time the equality test is performed. This means that a mutable collection might be equal to different collections at different times, depending what elements are added or removed. This is a potential trap when using a mutable collection as a key in a hashmap. Example: diff --git a/_overviews/collections/introduction.md b/_overviews/collections/introduction.md index 23136be5ec..39445c561f 100644 --- a/_overviews/collections/introduction.md +++ b/_overviews/collections/introduction.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/introduction.html num: 1 @@ -13,11 +14,6 @@ languages: [ja, zh-cn, ru] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - **Martin Odersky, and Lex Spoon** In the eyes of many, the new collections framework is the most significant diff --git a/_overviews/collections/iterators.md b/_overviews/collections/iterators.md index c273f87c12..abb3ca4a97 100644 --- a/_overviews/collections/iterators.md +++ b/_overviews/collections/iterators.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/iterators.html num: 15 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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-212-version }}/scala/collection/Iterator.html)'s `hasNext` method. The most straightforward way to "step through" all the elements returned by an iterator `it` uses a while-loop: diff --git a/_overviews/collections/maps.md b/_overviews/collections/maps.md index 6ba3b480b4..93b73342fa 100644 --- a/_overviews/collections/maps.md +++ b/_overviews/collections/maps.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/maps.html num: 7 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - 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) object 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. The fundamental operations on maps are similar to those on sets. They are summarized in the following table and fall into the following categories: diff --git a/_overviews/collections/overview.md b/_overviews/collections/overview.md index cc46a849ba..2b3db7713b 100644 --- a/_overviews/collections/overview.md +++ b/_overviews/collections/overview.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/overview.html num: 2 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - Scala collections systematically distinguish between mutable and immutable collections. A _mutable_ collection can be updated or extended in place. This means you can change, add, or remove elements diff --git a/_overviews/collections/performance-characteristics.md b/_overviews/collections/performance-characteristics.md index 96cbacbe59..55e8080163 100644 --- a/_overviews/collections/performance-characteristics.md +++ b/_overviews/collections/performance-characteristics.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/performance-characteristics.html num: 12 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - The previous explanations have made it clear that different collection types have different performance characteristics. That's often the primary reason for picking one collection type over another. You can see the performance characteristics of some common operations on collections summarized in the following two tables. Performance characteristics of sequence types: diff --git a/_overviews/collections/seqs.md b/_overviews/collections/seqs.md index 17aa7f708b..9883ce9c36 100644 --- a/_overviews/collections/seqs.md +++ b/_overviews/collections/seqs.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/seqs.html num: 5 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - The [Seq](http://www.scala-lang.org/api/current/scala/collection/Seq.html) trait represents sequences. A sequence is a kind of iterable that has a `length` and whose elements have fixed index positions, starting from `0`. The operations on sequences, summarized in the table below, fall into the following categories: diff --git a/_overviews/collections/sets.md b/_overviews/collections/sets.md index 85d21f3c28..76745eb8bb 100644 --- a/_overviews/collections/sets.md +++ b/_overviews/collections/sets.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/sets.html num: 6 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - `Set`s are `Iterable`s that contain no duplicate elements. The operations on sets are summarized in the following table for general sets and in the table after that for mutable sets. They fall into the following categories: * **Tests** `contains`, `apply`, `subsetOf`. The `contains` method asks whether a set contains a given element. The `apply` method for a set is the same as `contains`, so `set(elem)` is the same as `set contains elem`. That means sets can also be used as test functions that return true for the elements they contain. diff --git a/_overviews/collections/strings.md b/_overviews/collections/strings.md index a6545dbf6a..bb1a66dd5f 100644 --- a/_overviews/collections/strings.md +++ b/_overviews/collections/strings.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/strings.html num: 11 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - Like arrays, strings are not directly sequences, but they can be converted to them, and they also support all sequence operations on strings. Here are some examples of operations you can invoke on strings. scala> val str = "hello" diff --git a/_overviews/collections/trait-iterable.md b/_overviews/collections/trait-iterable.md index b708c251f5..5f07a242c8 100644 --- a/_overviews/collections/trait-iterable.md +++ b/_overviews/collections/trait-iterable.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/trait-iterable.html num: 4 @@ -13,11 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - The next trait from the top in the collections hierarchy is `Iterable`. All methods in this trait are defined in terms of an abstract method, `iterator`, which yields the collection's elements one by one. The `foreach` method from trait `Traversable` is implemented in `Iterable` in terms of `iterator`. Here is the actual implementation: def foreach[U](f: Elem => U): Unit = { diff --git a/_overviews/collections/views.md b/_overviews/collections/views.md index 4968547708..86bacf29e1 100644 --- a/_overviews/collections/views.md +++ b/_overviews/collections/views.md @@ -6,6 +6,7 @@ discourse: true partof: collections overview-name: Collections (Scala 2.8 - 2.12) +new-version: /overviews/collections-2.13/views.html num: 14 @@ -13,12 +14,6 @@ languages: [ja, zh-cn] permalink: /overviews/collections/:title.html --- - - See this in Scala 2.13 - - - Collections have quite a few methods that construct new collections. Examples are `map`, `filter` or `++`. We call such methods transformers because they take at least one collection as their receiver object and produce another collection as their result. There are two principal ways to implement transformers. One is _strict_, that is a new collection with all its elements is constructed as a result of the transformer. The other is non-strict or _lazy_, that is one constructs only a proxy for the result collection, and its elements get constructed only as one demands them. diff --git a/_sass/layout/documentation.scss b/_sass/layout/documentation.scss index c9c121e9a6..f1a16f69d5 100644 --- a/_sass/layout/documentation.scss +++ b/_sass/layout/documentation.scss @@ -58,7 +58,9 @@ } } -.link-to-newer-version { - float: right; - padding: 0 0 1em 1em; +a.new-version-notice { + display: block; + background: rgb(255, 255, 200); + font-size: large; + text-align: center; }