hachikuji commented on a change in pull request #8783: URL: https://github.com/apache/kafka/pull/8783#discussion_r436402304
########## File path: core/src/main/scala/kafka/log/LogCleaner.scala ########## @@ -112,9 +112,19 @@ 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 computed value or 0 if there is no cleaner + */ + private def computeCleanerThread(f: Seq[CleanerThread] => Int): Int = Review comment: Maybe we could turn this into a `foldLeft` and avoid the `map`. For example: ```scala private def maxOverCleanerThreads(f: CleanerThread => Int): Int = { cleaners.foldLeft(0, (acc: Int, thread: CleanerThread) => math.max(acc, f(thread))) } ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org