LoganZhuZzz commented on code in PR #18690:
URL: https://github.com/apache/kafka/pull/18690#discussion_r1929646792


##########
core/src/main/scala/kafka/log/LogCleaner.scala:
##########
@@ -116,16 +116,15 @@ class LogCleaner(initialConfig: CleanerConfig,
   private[log] val cleaners = mutable.ArrayBuffer[CleanerThread]()
 
   /**
-   * scala 2.12 does not support maxOption so we handle the empty manually.
    * @param f to compute the result
-   * @return the max value (int value) or 0 if there is no cleaner
+   * @return the max value or 0 if there is no cleaner
    */
-  private def maxOverCleanerThreads(f: CleanerThread => Double): Int =
-    cleaners.foldLeft(0.0d)((max: Double, thread: CleanerThread) => 
math.max(max, f(thread))).toInt
+  private[log] def maxOverCleanerThreads(f: CleanerThread => Double): Double =
+    cleaners.map(f).maxOption.getOrElse(0.0d)

Review Comment:
   Hi, @chia7712 . Thank you for the feedback! I’ve ensured that all changes 
are compatible with Scala 2.12 as required for the 3.9 branch. This includes:
   - Replacing maxOption with foldLeft for compatibility.
   - Avoiding Scala 2.13-specific features like underscore separators in 
numeric literals.
   - Ensuring test cases and implementation align with Scala 2.12 syntax and 
functionality.
   
   Let me know if there’s anything else you’d like me to adjust!



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

Reply via email to