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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java:
##########
@@ -1213,8 +1210,9 @@ private void clearAll() {
         }
 
         private List<NetworkClientDelegate.UnsentRequest> 
drainPendingCommits() {
-            ArrayList<NetworkClientDelegate.UnsentRequest> res = new 
ArrayList<>();
-            
res.addAll(unsentOffsetCommits.stream().map(OffsetCommitRequestState::toUnsentRequest).collect(Collectors.toList()));
+            ArrayList<NetworkClientDelegate.UnsentRequest> res = 
unsentOffsetCommits.stream()

Review Comment:
   We can declare List here



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java:
##########
@@ -1160,12 +1158,11 @@ List<NetworkClientDelegate.UnsentRequest> drain(final 
long currentTimeMs) {
             failAndRemoveExpiredCommitRequests(currentTimeMs);
 
             // Add all unsent offset commit requests to the unsentRequests list
-            unsentRequests.addAll(
-                    unsentOffsetCommits.stream()
-                        .filter(request -> 
request.canSendRequest(currentTimeMs))
-                        .peek(request -> request.onSendAttempt(currentTimeMs))
-                        .map(OffsetCommitRequestState::toUnsentRequest)
-                        .collect(Collectors.toList()));
+            List<NetworkClientDelegate.UnsentRequest> unsentRequests = 
unsentOffsetCommits.stream()
+                .filter(request -> request.canSendRequest(currentTimeMs))
+                .peek(request -> request.onSendAttempt(currentTimeMs))
+                .map(OffsetCommitRequestState::toUnsentRequest)
+                .collect(Collectors.toList());

Review Comment:
   We should use toCollection to define the implementation in order to avoid 
the possible JDK change in the future



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