I would like to know what is the memory usage of BitSet in Scala.For example, if I do:
var bitArray:BitSet=new BitSet(10)
bitArray.add(0)
bitArray.add(2)
bitArray.add(4)
bitArray.add(6)
bitArray.add(8)
How does that compare with and array containing the even numbers 0,2,4,6,8?
What about writing a number in binary:
var bitArray:BitSet=new BitSet(32)
bitArray.add(5)
bitArray.add(3)
bitArray.add(2)
bitArray.add(1)
bitArray.add(0)
How does that compare to the number 47?
I'm asking here of memory usage. But as a more open question, if you know, what are the advantages/disadvantages or uses of BitSet (WR to other common data types).
Thanks,
BitSet
, though anArray[Boolean]
is the same thing asBoolean[]
in Java. Closely related, but not exact duplicate. – Cuffs