code: public boolean metadataEquals(Map<String, byte[]> otherMetadata) {
      if (metadata == otherMetadata) {
        // Fast-path for common cases where the same actual default metadata instance may be used in
        // multiple different item infos.
        return true;
      }
      // No need to check if other `metadata` is not null,
      // because previous `if` checks if both of them are null.
      if (metadata == null || otherMetadata == null) {
        return false;
      }
      if (!metadata.keySet().equals(otherMetadata.keySet())) {
        return false;
      }
  
      // Compare each byte[] with Arrays.equals.
      for (Map.Entry<String, byte[]> metadataEntry : metadata.entrySet()) {
        if (!Arrays.equals(metadataEntry.getValue(), otherMetadata.get(metadataEntry.getKey()))) {
          return false;
        }
      }
      return true;
    }
docs: Helper for checking logical equality of metadata maps, checking equality of keySet() between
  this.metadata and otherMetadata, and then using Arrays.equals to compare contents of
  corresponding byte arrays.