Accumulo
  1. Accumulo
  2. ACCUMULO-2647

Replace String comparison if-then-else with switch

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.7.0
    • Component/s: start
    • Labels:

      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.

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

        Issue Links

          Activity

          Mike Drob created issue -
          Christopher Tubbs made changes -
          Field Original Value New Value
          Link This issue is related to ACCUMULO-1496 [ ACCUMULO-1496 ]
          Jeffrey S Schwartz made changes -
          Attachment ACCUMULO-2647.patch.txt [ 12650169 ]
          Jeffrey S Schwartz made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Labels newbie newbie summit2014
          Sean Busbey made changes -
          Assignee Jeffrey S Schwartz [ jschwartz73 ]
          Sean Busbey made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Jeffrey S Schwartz
              Reporter:
              Mike Drob
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development