File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
src/library/scala/collection Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
6969 s
7070 }
7171
72+ override def isEmpty : Boolean = 0 until nwords forall (i => word(i) == 0 )
73+
7274 implicit def ordering : Ordering [Int ] = Ordering .Int
7375
7476 def rangeImpl (from : Option [Int ], until : Option [Int ]): This = {
Original file line number Diff line number Diff line change @@ -37,6 +37,19 @@ object TestMutable {
3737 Console .println(" mi1 = " + ms1.toImmutable)
3838 Console .println(" mi2 = " + ms2.toImmutable)
3939 Console .println
40+
41+ val N = 257
42+ val gen = 3
43+ val bs = BitSet ((1 until N ): _* )
44+ (1 until N ).foldLeft(gen) {
45+ case (acc, i) =>
46+ assert(bs.size == N - i, s " Bad size for $bs, expected ${N - i} actual ${bs.size}" )
47+ assert(! bs.isEmpty, s " Unexpected isEmpty for $bs" )
48+ bs -= acc
49+ acc* gen % N
50+ }
51+ assert(bs.size == 0 , s " Expected size == 0 for $bs" )
52+ assert(bs.isEmpty, s " Expected isEmpty for $bs" )
4053}
4154
4255object TestMutable2 {
You can’t perform that action at this time.
0 commit comments