You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "sachin bhalekar (JIRA)" <ji...@apache.org> on 2017/11/16 03:15:00 UTC

[jira] [Created] (KAFKA-6218) Optimize condition in if statement to reduce the number of comparisons

sachin bhalekar created KAFKA-6218:
--------------------------------------

             Summary: 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: 1.0.0, 0.11.0.1, 0.11.0.0, 0.10.2.1, 0.10.2.0, 0.10.1.1, 0.10.1.0, 0.10.0.1, 0.10.0.0, 0.9.0.1, 0.9.0.0
            Reporter: sachin bhalekar
            Priority: Trivial
         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)