Java BitSet isEmpty() 方法

7 Jan 2025 | 1 分钟阅读

Java BitSet 类的 isEmpty() 方法,如果此 BitSet 不包含任何设置为 true 的位,则返回 true。

语法

参数

不适用

返回值

isEmpty() 方法根据此 BitSet 是否为空返回布尔值 true 或 false。

Exception

不适用

兼容版本

Java 1.4 或更高版本

示例 1

输出

bitset1: {1, 2, 3, 4}
bitset2: {}
bitset1 isEmpty: false
bitset2 isEmpty: true