[
https://issues.apache.org/jira/browse/KAFKA-6218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ewen Cheslack-Postava resolved KAFKA-6218.
------------------------------------------
Resolution: Fixed
Reviewer: Ewen Cheslack-Postava
> Optimize condition in if statement to reduce the number of comparisons
> ----------------------------------------------------------------------
>
> Key: KAFKA-6218
> URL: https://issues.apache.org/jira/browse/KAFKA-6218
> Project: Kafka
> Issue Type: Improvement
> Components: KafkaConnect
> Affects Versions: 0.9.0.0, 0.9.0.1, 0.10.0.0, 0.10.0.1, 0.10.1.0,
> 0.10.1.1, 0.10.2.0, 0.10.2.1, 0.11.0.0, 0.11.0.1, 1.0.0
> Reporter: sachin bhalekar
> Assignee: sachin bhalekar
> Priority: Trivial
> Labels: newbie
> Fix For: 1.1.0
>
> Attachments: kafka_optimize_if.JPG
>
>
> Optimizing the condition in *if *statement
> *(schema.name() == null || !(schema.name().equals(LOGICAL_NAME)))* which
> requires two comparisons in worst case with
> *(!LOGICAL_NAME.equals(schema.name()))* which requires single comparison
> in all cases and _avoids null pointer exception_.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)