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 @@ -44,6 +44,10 @@ package object compat {
44
44
def fromSpecific (source : TraversableOnce [Int ]): C = fact.apply(source.toSeq: _* )
45
45
}
46
46
47
+ implicit class StreamExtensionMethods [A ](private val stream : Stream [A ]) extends AnyVal {
48
+ def lazyAppendAll (as : => TraversableOnce [A ]): Stream [A ] = stream.append(as)
49
+ }
50
+
47
51
// This really belongs into scala.collection but there's already a package object in scala-library so we can't add to it
48
52
type IterableOnce [+ X ] = TraversableOnce [X ]
49
53
}
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