What is the reason for BitSet's size() method?

后端 未结 4 1383
青春惊慌失措
青春惊慌失措 2021-02-07 12:06

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 int

4条回答
  •  轮回少年
    2021-02-07 12:53

    It is the number of 0 and 1s which has to be a multiple of 64. You could use the cardinality() for the number of 1s.

提交回复
热议问题