Skip to content

Commit 450398f

Browse files
authored
Merge pull request scala#6902 from Prithvirajbilla/10979
Adds missing methods on immutable.Stream
2 parents 332ef15 + 0ccdf79 commit 450398f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,17 @@ sealed abstract class Stream[+A] extends AbstractSeq[A] with LinearSeq[A] with L
748748

749749
override protected[this] def writeReplace(): AnyRef =
750750
if(headDefined && tailDefined) new LazyListOps.SerializationProxy[A, Stream](this) else this
751+
752+
/** Prints elements of this stream one by one, separated by commas. */
753+
@deprecated("""Use print(stream.force.mkString(", ")) instead""")
754+
@inline def print(): Unit = Console.print(this.force.mkString(", "))
755+
756+
/** Prints elements of this stream one by one, separated by `sep`.
757+
* @param sep The separator string printed between consecutive elements.
758+
*/
759+
@deprecated("Use print(stream.force.mkString(sep)) instead")
760+
@inline def print(sep: String): Unit = Console.print(this.force.mkString(sep))
761+
751762
}
752763

753764
@deprecated("Use LazyList (which has a lazy head and tail) instead of Stream (which has a lazy tail only)", "2.13.0")

0 commit comments

Comments
 (0)