m1a2st commented on code in PR #19868:
URL: https://github.com/apache/kafka/pull/19868#discussion_r2118531153


##########
core/src/test/scala/integration/kafka/api/AbstractConsumerTest.scala:
##########
@@ -94,12 +94,18 @@ abstract class AbstractConsumerTest extends BaseRequestTest 
{
   def awaitNonEmptyRecords[K, V](consumer: Consumer[K, V],
                                  partition: TopicPartition,
                                  pollTimeoutMs: Long = 100): 
ConsumerRecords[K, V] = {
+    var result: ConsumerRecords[K, V] = null
+
     TestUtils.pollRecordsUntilTrue(consumer, (polledRecords: 
ConsumerRecords[K, V]) => {
-      if (polledRecords.records(partition).asScala.nonEmpty)
-        return polledRecords
-      false
+      if (polledRecords.records(partition).asScala.nonEmpty) {
+        result = polledRecords
+        true
+      } else {
+        false
+      }

Review Comment:
   We can directly use `.isEmpty` to avoid unnecessary conversion from Java 
collections to Scala collections.



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