File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
library/src/scala/collection/immutable Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ object Vector extends IndexedSeqFactory[Vector] {
31
31
// Constants governing concat strategy for performance
32
32
private final val Log2ConcatFaster = 5
33
33
private final val TinyAppendFaster = 2
34
+ private val emptyIterator : VectorIterator [Nothing ] = new VectorIterator [Nothing ](0 , 0 )
34
35
}
35
36
36
37
// in principle, most members should be private. however, access privileges must
@@ -94,9 +95,12 @@ extends AbstractSeq[A]
94
95
}
95
96
96
97
override def iterator : VectorIterator [A ] = {
97
- val s = new VectorIterator [A ](startIndex, endIndex)
98
- initIterator(s)
99
- s
98
+ if (length == 0 ) Vector .emptyIterator
99
+ else {
100
+ val s = new VectorIterator [A ](startIndex, endIndex)
101
+ initIterator(s)
102
+ s
103
+ }
100
104
}
101
105
102
106
override /* SeqLike*/
You can’t perform that action at this time.
0 commit comments