public static RoundChangeArtifacts create(final Collection<RoundChange> roundChanges) {

    final Comparator<RoundChange> preparedRoundComparator =
        (o1, o2) -> {
          if (o1.getPreparedRoundMetadata().isEmpty()) {
            return -1;
          }
          if (o2.getPreparedRoundMetadata().isEmpty()) {
            return 1;
          }

          int o1Round = o1.getPreparedRoundMetadata().get().getPreparedRound();
          int o2Round = o2.getPreparedRoundMetadata().get().getPreparedRound();

          return Integer.compare(o1Round, o2Round);
        };

    final Optional<RoundChange> roundChangeWithNewestPrepare =
        roundChanges.stream()
            .max(preparedRoundComparator)
            .flatMap(rc -> rc.getProposedBlock().map(pb -> rc));

    final Optional<PreparedCertificate> prepCert =
        roundChangeWithNewestPrepare.map(
            roundChange ->
                new PreparedCertificate(
                    roundChange.getProposedBlock().get(),
                    roundChange.getPrepares(),
                    roundChange.getPreparedRound().get()));

    return new RoundChangeArtifacts(
        roundChanges.stream().map(RoundChange::getSignedPayload).collect(Collectors.toList()),
        prepCert);
  }
Create round change artifacts.

@param roundChanges the round changes
@return the round change artifacts
consensus/qbft-core/src/main/java/org/hyperledger/besu/consensus/qbft/core/statemachine/RoundChangeArtifacts.java