public MonitoringKeysetInfo build() throws GeneralSecurityException {
      if (builderEntries == null) {
        throw new IllegalStateException("cannot call build() twice");
      }
      if (builderPrimaryKeyId != null) {
        // We allow the primary key to not be set. But if it is set, we verify that it is present in
        // the keyset.
        if (!isKeyIdInEntries(builderPrimaryKeyId.intValue())) {
          throw new GeneralSecurityException("primary key ID is not present in entries");
        }
      }
      MonitoringKeysetInfo output =
          new MonitoringKeysetInfo(
              builderAnnotations,
              Collections.unmodifiableList(builderEntries),
              builderPrimaryKeyId);
      // Collections.unmodifiableMap/List only gives an unmodifiable view of the underlying
      // collection. To make output immutable, we have to remove the reference to these collections.
      // This makes the builder unusable.
      builderEntries = null;
      return output;
    }
Builds the MonitoringKeysetInfo object. The builder is not usable anymore afterwards.
java_src/src/main/java/com/google/crypto/tink/monitoring/MonitoringKeysetInfo.java