diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-25 19:46:52 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-25 19:46:52 +0000 |
commit | 34d3f1cb95b1cc0fba242296026e546366c483d9 (patch) | |
tree | 2007c4f9d36eb4e1c4bc24cbf02577ef0db548d3 /src/library/scala/collection/mutable/StringBuilder.scala | |
parent | 49e8a4eef6d2e650f80f4e4817973102d1ea6335 (diff) | |
download | scala-34d3f1cb95b1cc0fba242296026e546366c483d9.tar.gz scala-34d3f1cb95b1cc0fba242296026e546366c483d9.tar.bz2 scala-34d3f1cb95b1cc0fba242296026e546366c483d9.zip |
Made mkString work correctly on views.
about how to obtain a String and how not to. Closes #4297, no review.
Diffstat (limited to 'src/library/scala/collection/mutable/StringBuilder.scala')
-rw-r--r-- | src/library/scala/collection/mutable/StringBuilder.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala index 6c3715e560..73d3778650 100644 --- a/src/library/scala/collection/mutable/StringBuilder.scala +++ b/src/library/scala/collection/mutable/StringBuilder.scala @@ -432,11 +432,24 @@ final class StringBuilder(private val underlying: JavaStringBuilder) /** Returns a new String representing the data in this sequence. * + * @note because toString is inherited from AnyRef and used for + * many purposes, it is better practice to call mkString + * to obtain a StringBuilder result. * @return the current contents of this sequence as a String */ override def toString = underlying.toString + + /** Returns a new String representing the data in this sequence. + * + * @return the current contents of this sequence as a String + */ override def mkString = toString + /** Returns the result of this Builder, which in the case + * of StringBuilders is a StringBuilder (not a String.) + * + * @return this StringBuilder + */ def result(): StringBuilder = this } |