divijvaidya commented on code in PR #13096:
URL: https://github.com/apache/kafka/pull/13096#discussion_r1067076574


##########
core/src/main/scala/kafka/server/metadata/KRaftMetadataCache.scala:
##########
@@ -364,10 +364,7 @@ class KRaftMetadataCache(val brokerId: Int) extends 
MetadataCache with Logging w
     _currentImage.topics().topicsByName().containsKey(topicName)
 
   override def contains(tp: TopicPartition): Boolean = {
-    Option(_currentImage.topics().getTopic(tp.topic())) match {
-      case None => false
-      case Some(topic) => topic.partitions().containsKey(tp.partition())
-    }
+    Option(_currentImage.topics().getTopic(tp.topic())).exists(topic => 
topic.partitions().containsKey(tp.partition()))

Review Comment:
   FYI reviewers:
   Usage of Option.exists. No extra allocations as mentioned in an earlier 
comment



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