Code example for BitSet

Methods: set

0
	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);
	} 
 
	private static class BitsDocIdSetIterator extends DocIdSetIterator 
	{ 
		private final BitSet _bs;
		private int _current;