squah-confluent commented on code in PR #23888:
URL: https://github.com/apache/kafka/pull/23888#discussion_r4335929334
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/share/ShareGroup.java:
##########
@@ -97,6 +99,33 @@ public record InitMapValue(
Set<Integer> partitions,
long timestamp
) {
+ public InitMapValue {
+ partitions = Set.copyOf(partitions);
+ }
+
+ public InitMapValue(String name, Collection<Integer> partitions, long
timestamp) {
+ this(name, Set.copyOf(partitions), timestamp);
+ }
+
+ /**
+ * @param added The partitions to add.
+ * @return A copy of this value with the partitions added.
+ */
+ public InitMapValue withAddedPartitions(Collection<Integer> added) {
+ Set<Integer> newPartitions = new HashSet<>(partitions);
+ newPartitions.addAll(added);
+ return new InitMapValue(name, newPartitions, timestamp);
Review Comment:
Do you mean replacing `Set.copyOf` with `Collections.unmodifiableSet` in the
constructor or passing an `unmodifiableSet` wrapper in to the existing
constructor?
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/share/ShareGroup.java:
##########
Review Comment:
Yes, we can do that too
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]