// collect size to alleviate #getCount if needed
int collectionSize = 0;
while (reader.hasNext()) {
featureBounds = reader.next().getBounds();
bounds.expandToInclude(featureBounds.getMinX(), featureBounds.getMinY());
bounds.expandToInclude(featureBounds.getMaxX(), featureBounds.getMaxY());
collectionSize++;
}
if (this.cachedSize == -1) {
this.cachedSize = collectionSize;
}