private void branchOrTagSummary(Table table, SummaryMapBuilder builder) {
    Map<String, SnapshotRef> refs = table.refs();
    AtomicInteger numBranches = new AtomicInteger(0);
    AtomicInteger numTags = new AtomicInteger(0);
    if (refs != null) {
      refs.forEach((key, value) -> {
        if (value.isBranch()) {
          numBranches.getAndIncrement();
        } else {
          numTags.getAndIncrement();
        }
      });
    }
    builder.add(NUM_BRANCHES, numBranches.get()).add(NUM_TAGS, numTags.get());
  }
Collect the metadata summary for the table, like the number of snapshots, data files
or the partition count.
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/metasummary/MetadataSummary.java