list.add(s);
randomAccessList.add(s);
}
final RandomAccessDocIdSet[] randomAccessDocIdSets = randomAccessList
.toArray(new RandomAccessDocIdSet[randomAccessList.size()]);
final DocIdSet andDocIdSet = new AndDocIdSet(list);
return new RandomAccessDocIdSet() {
@Override
public boolean get(int docId) {
for (RandomAccessDocIdSet s : randomAccessDocIdSets) {
if (!s.get(docId)) return false;
}
return true;
}
@Override
public DocIdSetIterator iterator() throws IOException {
return andDocIdSet.iterator();
}
};
}
}