What is the reason for BitSet's size() method?
问题 Is there a use case for the size() method on the java.util.BitSet class? I mean - the JavaDoc clearly says it's implementation dependant, it returns the size of the internal long[] storage in bits. From what it says, one could conclude that you won't be able to set a bit with a higher index than size() , but that's not true, the BitSet can grow automatically: BitSet myBitSet = new BitSet(); System.out.println(myBitSet.size()); // prints "64" myBitSet.set(768); System.out.println(myBitSet.size