public Integer partitionCountForTopic(String topic) {
        List<PartitionInfo> partitions = this.partitionsByTopic.get(topic);
        return partitions == null ? null : partitions.size();
    }
Get the number of partitions for the given topic.
@param topic The topic to get the number of partitions for
@return The number of partitions or null if there is no corresponding metadata
clients/src/main/java/org/apache/kafka/common/Cluster.java