chia7712 commented on code in PR #20348:
URL: https://github.com/apache/kafka/pull/20348#discussion_r2296244873


##########
raft/src/main/java/org/apache/kafka/raft/internals/EpochElection.java:
##########
@@ -27,17 +27,11 @@
 /**
  *  Tracks the votes cast by voters in an election held by a Nominee.
  */
-public class EpochElection {
-    private Map<Integer, VoterState> voterStates;
-
+public record EpochElection(Map<Integer, VoterState> voterStates) {

Review Comment:
   the `voterIds` could return `voterStates.keySet()` instead if `voterStates` 
is immutable.



##########
raft/src/main/java/org/apache/kafka/raft/internals/EpochElection.java:
##########
@@ -27,17 +27,11 @@
 /**
  *  Tracks the votes cast by voters in an election held by a Nominee.
  */
-public class EpochElection {
-    private Map<Integer, VoterState> voterStates;
-
+public record EpochElection(Map<Integer, VoterState> voterStates) {

Review Comment:
   Could you please make `voterStates` immutable?



##########
raft/src/main/java/org/apache/kafka/raft/internals/EpochElection.java:
##########
@@ -27,17 +27,11 @@
 /**
  *  Tracks the votes cast by voters in an election held by a Nominee.
  */
-public class EpochElection {
-    private Map<Integer, VoterState> voterStates;
-
+public record EpochElection(Map<Integer, VoterState> voterStates) {

Review Comment:
   Also, the `toString` could be removed



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to