MINOR; Use Option to check for null values
Use `Option` instead of `match` to check for `null` values.
Reviewers: Jason Gustafson
@@ -2749,13 +2749,12 @@ class KafkaApis(val requestChannel: RequestChannel,
)
}
- val partitionsOpt = listPartitionReassignmentsRequest.data.topics match {
- case topics: Any =>
- Some(topics.iterator().asScala.flatMap { topic =>
- topic.partitionIndexes.iterator().asScala
- .map { tp => new TopicPartition(topic.name(), tp) }
- }.toSet)
- case _ => None
+ val partitionsOpt = Option(listPartitionReassignmentsRequest.data.topics).map { topics =>
+ topics.iterator().asScala.flatMap { topic =>
+ topic.partitionIndexes.iterator().asScala.map { partitionIndex =>
+ new TopicPartition(topic.name(), partitionIndex)
+ }
+ }.toSet
}
zkSupport.controller.listPartitionReassignments(partitionsOpt, sendResponseCallback)
