File tree 2 files changed +19
-0
lines changed
main/scala-2.12/collection/compat
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ package object compat {
41
41
def fromSpecific (source : TraversableOnce [Int ]): C = fact.apply(source.toSeq: _* )
42
42
}
43
43
44
+ implicit class StreamExtensionMethods [A ](private val stream : Stream [A ]) extends AnyVal {
45
+ def lazyAppendAll (as : => TraversableOnce [A ]): Stream [A ] = stream.append(as)
46
+ }
47
+
44
48
// This really belongs into scala.collection but there's already a package object in scala-library so we can't add to it
45
49
type IterableOnce [+ X ] = TraversableOnce [X ]
46
50
}
Original file line number Diff line number Diff line change
1
+ package collection
2
+
3
+ import org .junit .Test
4
+
5
+ import scala .collection .compat ._
6
+
7
+ class StreamTest {
8
+
9
+ @ Test
10
+ def lazyAppendAll (): Unit = {
11
+ val s = 1 #:: 2 #:: 3 #:: Stream .Empty
12
+ s.lazyAppendAll(List (4 , 5 , 6 ))
13
+ }
14
+
15
+ }
You can’t perform that action at this time.
0 commit comments