private int numRegionsForTable(TableName tn, Map<RegionInfo, Long> regions) {
    int sum = 0;
    for (Entry<RegionInfo, Long> entry : regions.entrySet()) {
      if (tn.equals(entry.getKey().getTable()) && 0 < entry.getValue()) {
        sum++;
      }
    }
    return sum;
  }
Computes the number of regions for the given table that have a positive size.
@param tn      The TableName in question
@param regions A collection of region sizes
@return The number of regions for the given table.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestRegionSizeUse.java