Code example for BitSet

Methods: cardinality

0
	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;
		BitsDocIdSetIterator(BitSet bs)
		{ 
			_bs=bs;
			_current=-1;