Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-2647

Replace String comparison if-then-else with switch

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.7.0
    • start

    Description

      In o.a.a.start.Main we have a giant if-then-else ladder for determining which class to use. With Java 7, we can replace this with a switch statement.

      The switch statement compares the String object in its expression with the expressions associated with each case label as if it were using the String.equals method; consequently, the comparison of String objects in switch statements is case sensitive. The Java compiler generates generally more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.

      Attachments

        1. ACCUMULO-2647.patch.txt
          7 kB
          Jeffrey S Schwartz

        Issue Links

          Activity

            People

              jschwartz73 Jeffrey S Schwartz
              mdrob Mike Drob
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: