File tree Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Scala (https://www.scala-lang.org)
3
+ *
4
+ * Copyright EPFL and Lightbend, Inc.
5
+ *
6
+ * Licensed under Apache License 2.0
7
+ * (http://www.apache.org/licenses/LICENSE-2.0).
8
+ *
9
+ * See the NOTICE file distributed with this work for
10
+ * additional information regarding copyright ownership.
11
+ */
12
+
13
+ package scala .collection .immutable
14
+
15
+ import scala .collection .{IterableFactory , IterableFactoryDefaults }
16
+ import language .experimental .captureChecking
17
+
18
+ /** A trait for collections that are guaranteed immutable.
19
+ *
20
+ * @tparam A the element type of the collection
21
+ *
22
+ * @define coll immutable collection
23
+ * @define Coll `immutable.Iterable`
24
+ */
25
+ trait Iterable [+ A ] extends collection.Iterable [A ]
26
+ with collection.IterableOps [A , Iterable , Iterable [A ]]
27
+ with IterableFactoryDefaults [A , Iterable ] {
28
+ this : Iterable [A ]^ =>
29
+
30
+ override def iterableFactory : IterableFactory [Iterable ] = Iterable
31
+ }
32
+
33
+ @ SerialVersionUID (3L )
34
+ object Iterable extends IterableFactory .Delegate [Iterable ](List ) {
35
+ override def from [E ](it : IterableOnce [E ]): Iterable [E ] = it match {
36
+ case iterable : Iterable [E ] => iterable
37
+ case _ => super .from(it)
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Scala (https://www.scala-lang.org)
3
+ *
4
+ * Copyright EPFL and Lightbend, Inc.
5
+ *
6
+ * Licensed under Apache License 2.0
7
+ * (http://www.apache.org/licenses/LICENSE-2.0).
8
+ *
9
+ * See the NOTICE file distributed with this work for
10
+ * additional information regarding copyright ownership.
11
+ */
12
+
13
+ package scala .collection .mutable
14
+
15
+ import scala .collection .{IterableFactory , IterableFactoryDefaults }
16
+ import language .experimental .captureChecking
17
+
18
+ trait Iterable [A ]
19
+ extends collection.Iterable [A ]
20
+ with collection.IterableOps [A , Iterable , Iterable [A ]]
21
+ with IterableFactoryDefaults [A , Iterable ] {
22
+ this : Iterable [A ]^ =>
23
+
24
+ override def iterableFactory : IterableFactory [Iterable ] = Iterable
25
+ }
26
+
27
+ /**
28
+ * $factoryInfo
29
+ * @define coll mutable collection
30
+ * @define Coll `mutable.Iterable`
31
+ */
32
+ @ SerialVersionUID (3L )
33
+ object Iterable extends IterableFactory .Delegate [Iterable ](ArrayBuffer )
34
+
35
+ /** Explicit instantiation of the `Iterable` trait to reduce class file size in subclasses. */
36
+ abstract class AbstractIterable [A ] extends scala.collection.AbstractIterable [A ] with Iterable [A ]:
37
+ this : AbstractIterable [A ]^ =>
Original file line number Diff line number Diff line change
1
+ collection/ immutable/ Iterable .scala
Original file line number Diff line number Diff line change
1
+ collection/ mutable/ Iterable .scala
You can’t perform that action at this time.
0 commit comments