Skip to content

Commit a6b4252

Browse files
authored
Merge pull request scala/scala#10293 from som-snytt/issue/12710-stringbuilder-doc
Tweak class doc for StringBuilder
2 parents aa6ef69 + b16c52f commit a6b4252

17 files changed

+40
-27
lines changed

library/src/scala/Array.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ object Array {
624624
*
625625
* @see [[https://www.scala-lang.org/files/archive/spec/2.13/ Scala Language Specification]], for in-depth information on the transformations the Scala compiler makes on Arrays (Sections 6.6 and 6.15 respectively.)
626626
* @see [[https://docs.scala-lang.org/sips/scala-2-8-arrays.html "Scala 2.8 Arrays"]] the Scala Improvement Document detailing arrays since Scala 2.8.
627-
* @see [[https://docs.scala-lang.org/overviews/collections/arrays.html "The Scala 2.8 Collections' API"]] section on `Array` by Martin Odersky for more information.
627+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/arrays.html "The Scala 2.8 Collections' API"]] section on `Array` by Martin Odersky for more information.
628628
* @hideImplicitConversion scala.Predef.booleanArrayOps
629629
* @hideImplicitConversion scala.Predef.byteArrayOps
630630
* @hideImplicitConversion scala.Predef.charArrayOps

library/src/scala/collection/concurrent/Map.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import scala.annotation.tailrec
1919
*
2020
* $concurrentmapinfo
2121
*
22-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#concurrent_maps "Scala's Collection Library overview"]]
22+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#concurrent_maps "Scala's Collection Library overview"]]
2323
* section on `Concurrent Maps` for more information.
2424
*
2525
* @tparam K the key type of the map

library/src/scala/collection/immutable/BitSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import scala.annotation.{implicitNotFound, nowarn}
2020

2121
/** A class for immutable bitsets.
2222
* $bitsetinfo
23-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#immutable-bitsets "Scala's Collection Library overview"]]
23+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#immutable-bitsets "Scala's Collection Library overview"]]
2424
* section on `Immutable BitSets` for more information.
2525
*
2626
* @define Coll `immutable.BitSet`

library/src/scala/collection/immutable/LazyList.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ import scala.runtime.Statics
220220
*
221221
* @tparam A the type of the elements contained in this lazy list.
222222
*
223-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#lazylists "Scala's Collection Library overview"]]
223+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#lazylists "Scala's Collection Library overview"]]
224224
* section on `LazyLists` for more information.
225225
* @define Coll `LazyList`
226226
* @define coll lazy list

library/src/scala/collection/immutable/List.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import scala.runtime.Statics.releaseFence
6565
* objects that rely on structural sharing), will be serialized and deserialized with multiple lists, one for
6666
* each reference to it. I.e. structural sharing is lost after serialization/deserialization.
6767
*
68-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#lists "Scala's Collection Library overview"]]
68+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#lists "Scala's Collection Library overview"]]
6969
* section on `Lists` for more information.
7070
*
7171
* @define coll list

library/src/scala/collection/immutable/ListMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ sealed class ListMap[K, +V]
119119
* n elements will take O(n^2^) time. This makes the builder suitable only for a small number of
120120
* elements.
121121
*
122-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#list-maps "Scala's Collection Library overview"]]
122+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#list-maps "Scala's Collection Library overview"]]
123123
* section on `List Maps` for more information.
124124
* @define Coll ListMap
125125
* @define coll list map

library/src/scala/collection/immutable/Queue.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import scala.collection.mutable.{Builder, ListBuffer}
2727
* where a pivot is required, in which case, a cost of `O(n)` is incurred, where `n` is the number of elements in the queue. When this happens,
2828
* `n` remove operations with `O(1)` cost are guaranteed. Removing an item is on average `O(1)`.
2929
*
30-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#immutable-queues "Scala's Collection Library overview"]]
30+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#immutable-queues "Scala's Collection Library overview"]]
3131
* section on `Immutable Queues` for more information.
3232
*
3333
* @define Coll `immutable.Queue`

library/src/scala/collection/immutable/TreeMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import scala.runtime.AbstractFunction2
6060
* @tparam V the type of the values associated with the keys.
6161
* @param ordering the implicit ordering used to compare objects of type `A`.
6262
*
63-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#red-black-trees "Scala's Collection Library overview"]]
63+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#red-black-trees "Scala's Collection Library overview"]]
6464
* section on `Red-Black Trees` for more information.
6565
*
6666
* @define Coll immutable.TreeMap

library/src/scala/collection/immutable/TreeSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import scala.runtime.AbstractFunction1
2626
* @tparam A the type of the elements contained in this tree set
2727
* @param ordering the implicit ordering used to compare objects of type `A`
2828
*
29-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#red-black-trees "Scala's Collection Library overview"]]
29+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#red-black-trees "Scala's Collection Library overview"]]
3030
* section on `Red-Black Trees` for more information.
3131
*
3232
* @define Coll `immutable.TreeSet`

library/src/scala/collection/mutable/ArrayBuffer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import scala.collection.generic.DefaultSerializable
2626
* access take constant time (amortized time). Prepends and removes are
2727
* linear in the buffer size.
2828
*
29-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#array-buffers "Scala's Collection Library overview"]]
29+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#array-buffers "Scala's Collection Library overview"]]
3030
* section on `Array Buffers` for more information.
3131
3232
*

library/src/scala/collection/mutable/BitSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import scala.annotation.implicitNotFound
2323
*
2424
* $bitsetinfo
2525
*
26-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable-bitsets "Scala's Collection Library overview"]]
26+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#mutable-bitsets "Scala's Collection Library overview"]]
2727
* section on `Mutable Bitsets` for more information.
2828
*
2929
* @define Coll `BitSet`

library/src/scala/collection/mutable/CollisionProofHashMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import scala.runtime.Statics
2424
* as determined by the `Ordering` has to be consistent with `equals` and `hashCode`. Universal equality
2525
* of numeric types is not supported (similar to `AnyRefMap`).
2626
*
27-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
27+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
2828
* section on `Hash Tables` for more information.
2929
*
3030
* @define Coll `mutable.CollisionProofHashMap`

library/src/scala/collection/mutable/HashMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import scala.util.hashing.MurmurHash3
2020

2121
/** This class implements mutable maps using a hashtable.
2222
*
23-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
23+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
2424
* section on `Hash Tables` for more information.
2525
*
2626
* @tparam K the type of the keys contained in this hash map.

library/src/scala/collection/mutable/HashSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import scala.util.hashing.MurmurHash3
2020

2121
/** This class implements mutable sets using a hashtable.
2222
*
23-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
23+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]]
2424
* section on `Hash Tables` for more information.
2525
*
2626
* @define Coll `mutable.HashSet`

library/src/scala/collection/mutable/ListBuffer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import scala.runtime.Statics.releaseFence
2323
/** A `Buffer` implementation backed by a list. It provides constant time
2424
* prepend and append. Most other operations are linear.
2525
*
26-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#list-buffers "Scala's Collection Library overview"]]
26+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#list-buffers "Scala's Collection Library overview"]]
2727
* section on `List Buffers` for more information.
2828
*
2929
* @tparam A the type of this list buffer's elements.

library/src/scala/collection/mutable/StringBuilder.scala

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,30 @@ import scala.Predef.{ // unimport char-related implicit conversions to avoid tri
2424
//_
2525
}
2626

27-
/** A builder for mutable sequence of characters. This class provides an API
28-
* mostly compatible with `java.lang.StringBuilder`, except where there are
29-
* conflicts with the Scala collections API (such as the `reverse` method.)
30-
*
31-
* $multipleResults
32-
*
33-
* @define Coll `mutable.IndexedSeq`
34-
* @define coll string builder
35-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#stringbuilders "Scala's Collection Library overview"]]
36-
* section on `StringBuilders` for more information.
37-
*/
27+
/** A builder of `String` which is also a mutable sequence of characters.
28+
*
29+
* This class provides an API mostly compatible with `java.lang.StringBuilder`,
30+
* except where there are conflicts with the Scala collections API, such as the `reverse` method:
31+
* [[reverse]] produces a new `StringBuilder`, and [[reverseInPlace]] mutates this builder.
32+
*
33+
* Mutating operations return either `this.type`, i.e., the current builder, or `Unit`.
34+
*
35+
* Other methods extract data or information from the builder without mutating it.
36+
*
37+
* The distinction is also reflected in naming conventions used by collections,
38+
* such as `append`, which mutates, and `appended`, which does not, or `reverse`,
39+
* which does not mutate, and `reverseInPlace`, which does.
40+
*
41+
* The `String` result may be obtained using either `result()` or `toString`.
42+
*
43+
* $multipleResults
44+
*
45+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#stringbuilders "Scala's Collection Library overview"]]
46+
* section on `StringBuilders` for more information.
47+
*
48+
* @define Coll `mutable.IndexedSeq`
49+
* @define coll string builder
50+
*/
3851
@SerialVersionUID(3L)
3952
final class StringBuilder(val underlying: java.lang.StringBuilder) extends AbstractSeq[Char]
4053
with ReusableBuilder[Char, String]

library/src/scala/collection/mutable/WeakHashMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import scala.collection.convert.JavaCollectionWrappers.{JMapWrapper, JMapWrapper
2424
* @tparam K type of keys contained in this map
2525
* @tparam V type of values associated with the keys
2626
*
27-
* @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#weak-hash-maps "Scala's Collection Library overview"]]
27+
* @see [[https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#weak-hash-maps "Scala's Collection Library overview"]]
2828
* section on `Weak Hash Maps` for more information.
2929
*
3030
* @define Coll `WeakHashMap`

0 commit comments

Comments
 (0)