frankvicky commented on code in PR #18783: URL: https://github.com/apache/kafka/pull/18783#discussion_r1938893604
########## server-common/src/main/java/org/apache/kafka/server/common/TopicIdPartition.java: ########## @@ -18,45 +18,15 @@ import org.apache.kafka.common.Uuid; -import java.util.Objects; - /** * Represents a partition using its unique topic Id and partition number. + * @param topicId Universally unique Id representing this topic partition. + * @param partitionId The partition Id. */ -public final class TopicIdPartition { - private final Uuid topicId; - private final int partitionId; - - public TopicIdPartition(Uuid topicId, int partitionId) { - this.topicId = topicId; - this.partitionId = partitionId; - } - - /** - * @return Universally unique Id representing this topic partition. - */ - public Uuid topicId() { - return topicId; - } - - /** - * @return The partition Id. - */ - public int partitionId() { - return partitionId; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof TopicIdPartition other)) return false; - return other.topicId.equals(topicId) && other.partitionId == partitionId; - } - - @Override - public int hashCode() { - return Objects.hash(topicId, partitionId); - } - +public record TopicIdPartition( + Uuid topicId, + int partitionId +) { @Override public String toString() { return topicId + ":" + partitionId; Review Comment: `org.apache.kafka.server.AssignmentTest#testAssignmentToString` has an assertion for the `toString` output. Hence, I don't remove this one. -- 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