chia7712 commented on code in PR #19475: URL: https://github.com/apache/kafka/pull/19475#discussion_r2068692504
########## server-common/src/main/java/org/apache/kafka/server/common/OffsetAndEpoch.java: ########## @@ -16,40 +16,11 @@ */ package org.apache.kafka.server.common; -public class OffsetAndEpoch { - private final long offset; - private final int leaderEpoch; - - public OffsetAndEpoch(long offset, int leaderEpoch) { - this.offset = offset; - this.leaderEpoch = leaderEpoch; - } - - public long offset() { - return offset; - } - - public int leaderEpoch() { - return leaderEpoch; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - OffsetAndEpoch that = (OffsetAndEpoch) o; - return offset == that.offset && leaderEpoch == that.leaderEpoch; - } - - @Override - public int hashCode() { - int result = leaderEpoch; - result = 31 * result + Long.hashCode(offset); - return result; - } - +public record OffsetAndEpoch(long offset, int leaderEpoch) implements Comparable<OffsetAndEpoch> { Review Comment: Maybe we can rename `leaderEpoch` to `epoch` for minimum change? -- 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