package Contain; import java.util.BitSet; public class MyBitset { public static void main(String[] args) {
BitSet bm = new BitSet();
System.out.println(bm.isEmpty() + "--" + bm.size()); int i = 0;
for (i = 0; i < 100; i++){
bm.set(i);
}
System.out.println(bm.isEmpty() + "--" + bm.size()); for (i = 0; i < 100; i++){
System.out.println(bm.get(i));
}
}
}
按64倍数扩容。 线程不安全。key越大,占用内存越多size