Code example for BitSet

0
	public BitsetDocSet() { 
		_bs=new BitSet();
	} 
	 
	public BitsetDocSet(int nbits) {
		_bs=new BitSet(nbits);
	} 
 
	public void addDoc(int docid) {
		_bs.set(docid);
	} 
 
	public int size() { 
		return _bs.cardinality();
	} 
 
	@Override 
	public DocIdSetIterator iterator() { 
		return new BitsDocIdSetIterator(_bs);
	}