The default behavior for getCount is to use estimated statistics if available, or -1 to indicate that the operation would be expensive (@see org.geotools.data.FeatureSource#getCount(org.geotools.data.Query)).
The default behavior for getCount is to use estimated statistics if available, or -1 to indicate that the operation would be expensive (@see org.geotools.data.FeatureSource#getCount(org.geotools.data.Query)).
Since users may want exact counts, there are two ways to force exact counts:
query