If you only need individual bits, then collection.BitSet will work for you.
If you need the right class of bit fields, you're out of luck for two reasons. Firstly, because Scala does not have one. Secondly, because even if that were the case, the space savings would probably not be very impressive, since the overhead of the wrapper object would probably be large compared to your bits.
There are several ways out of this with some work: a custom class that wraps an integer and allows you to work with its parts as bit fields; when you go to save an integer, you just saved it as a primitive int. Or you can create an array of bitfield structures (of arbitrary length) that are implemented as an array of integers. But there was nothing of the sort; you have to collapse yourself.
Rex kerr
source share