Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13512

topicIdsToNames and topicNamesToIds allocate unnecessary maps

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 3.1.0
    • 3.1.0
    • None
    • None

    Description

      Currently we write the methods as follows:

      def topicNamesToIds(): util.Map[String, Uuid] = {
          new util.HashMap(metadataSnapshot.topicIds.asJava)
      }

      We do not need to allocate a new map however, we can simply use

      Collections.unmodifiableMap(metadataSnapshot.topicIds.asJava)

      We can do something similar for the topicIdsToNames implementation.

      Attachments

        Issue Links

          Activity

            People

              jolshan Justine Olshan
              jolshan Justine Olshan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: