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

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

     [ https://issues.apache.org/jira/browse/KAFKA-6218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ewen Cheslack-Postava updated KAFKA-6218:
-----------------------------------------
    Fix Version/s: 1.1.0

> 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)