31. public class SmartWappedBitSet implements Set<Integer> {
private static final int DEFAULT_BLOCK_SIZE = 10000;//bit??
private int INIT_BLOCK_SIZE;
private final Map<Integer,BitSet> folder;
public SmartWappedBitSet(final int blockSize) {
this.INIT_BLOCK_SIZE = blockSize;
folder = new HashMap<Integer,BitSet>();
}
public SmartWappedBitSet() {
this(DEFAULT_BLOCK_SIZE);
}
@Override
public boolean add(Integer e) {
final int index = e / INIT_BLOCK_SIZE;
final int value = e % INIT_BLOCK_SIZE;
if (!folder.containsKey(index)) {
folder.put(index, new BitSet());
}
folder.get(index).set(value);
return true;
}