I would like to know what is the use of BitSet memory in Scala. For example, if I do this:
var bitArray:BitSet=new BitSet(10)
bitArray.add(0)
bitArray.add(2)
bitArray.add(4)
bitArray.add(6)
bitArray.add(8)
How does this compare to an array containing even numbers 0,2,4,6,8?
How to write a number in binary format:
var bitArray:BitSet=new BitSet(32)
bitArray.add(5)
bitArray.add(3)
bitArray.add(2)
bitArray.add(1)
bitArray.add(0)
How does this compare to number 47?
I ask about memory usage. But as a more open question, if you know what are the advantages / disadvantages or the use of BitSet (WR for other common data types).
Thank,
Skuge source
share