chia7712 commented on code in PR #19062: URL: https://github.com/apache/kafka/pull/19062#discussion_r1978744123
########## raft/src/main/java/org/apache/kafka/raft/internals/LogHistory.java: ########## @@ -76,42 +75,5 @@ public interface LogHistory<T> { */ void clear(); - final class Entry<T> { - private final long offset; - private final T value; - - public Entry(long offset, T value) { - this.offset = offset; - this.value = value; - } - - public long offset() { - return offset; - } - - public T value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Entry<?> that = (Entry<?>) o; - - if (offset != that.offset) return false; - return Objects.equals(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hash(offset, value); - } - - @Override - public String toString() { - return String.format("Entry(offset=%d, value=%s)", offset, value); - } - } + record Entry<T>(long offset, T value) { } Review Comment: Could we use `Map.Entry` instead? The main difference is `Map.Entry` can't accept null key/value. However, I grep the path and it seems the origin design does not accept null value as well -- 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