divijvaidya commented on code in PR #13096: URL: https://github.com/apache/kafka/pull/13096#discussion_r1067072339
########## core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala: ########## @@ -761,10 +761,7 @@ class KRaftClusterTest { image: ClusterImage, brokerId: Int ): Boolean = { - Option(image.brokers().get(brokerId)) match { - case None => false - case Some(registration) => !registration.fenced() - } + Option(image.brokers().get(brokerId)).exists(registration => !registration.fenced()) Review Comment: FYI reviewers - No new object allocation here inside Option.flatMap. Implementation of exists: ``` @inline final def exists(p: A => Boolean): Boolean = !isEmpty && p(this.get) ``` ########## core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala: ########## @@ -761,10 +761,7 @@ class KRaftClusterTest { image: ClusterImage, brokerId: Int ): Boolean = { - Option(image.brokers().get(brokerId)) match { - case None => false - case Some(registration) => !registration.fenced() - } + Option(image.brokers().get(brokerId)).exists(registration => !registration.fenced()) Review Comment: FYI reviewers - No new object allocation here inside Option.exists. Implementation of exists: ``` @inline final def exists(p: A => Boolean): Boolean = !isEmpty && p(this.get) ``` -- 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