dajac commented on code in PR #23888:
URL: https://github.com/apache/kafka/pull/23888#discussion_r4336327643


##########
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:
   Either way is fine. I don't really have a preference and I don't think that 
we have established a pattern (yet).



-- 
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]

Reply via email to