Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6218

Optimize condition in if statement to reduce the number of comparisons

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 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
    • 1.1.0
    • connect

    Description

      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.

      Attachments

        1. kafka_optimize_if.JPG
          46 kB
          sachin bhalekar

        Issue Links

          Activity

            People

              sachinbhalekar sachin bhalekar
              sachinbhalekar sachin bhalekar
              Ewen Cheslack-Postava Ewen Cheslack-Postava
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: