Is there any particular reason why these are missing?
They do exist in BigInteger, but due to the immutable design pattern of BigInteger these are usually awfully slow. BitSet is much nicer because it is mutable, but I really miss the shift functions (<< and >>> for longs). For BitSet, an inplace shifting would also be useful, as well as cyclic rotation.
I have seen the reply to Shifting a Java BitSet (using get(off, len) for shifting; however this requires copying).
Don’t get me wrong. I know where to report bugs. I’m just wondering if there was a particular reason to omit them, e.g. some design pattern or such a concept. In particular as they are included in BigInteger.
Conceptually, a
BitSetis typically / often used for tracking a lot of settings, such that each bit in the set has a specific meaning. So a shift operation makes little sense in that context.You’ve clearly found another useful purpose for a
BitSet, but it’s outside the scope for whichBitSetwas probably envisioned.