You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Christopher Tubbs (JIRA)" <ji...@apache.org> on 2014/04/08 20:21:22 UTC
[jira] [Commented] (ACCUMULO-2647) Replace String comparison
if-then-else with switch
[ https://issues.apache.org/jira/browse/ACCUMULO-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13963270#comment-13963270 ]
Christopher Tubbs commented on ACCUMULO-2647:
---------------------------------------------
In the code for ACCUMULO-1496, I've used annotations and searched for annotated classes. That was slow, due to the indexing of the annotations. For this ticket, we could adopt a hybrid approach, looping over a set of known classes, reading the annotations, rather than doing all the if statements. (It would also simplify the merge if we revisit ACCUMULO-1496.)
> Replace String comparison if-then-else with switch
> --------------------------------------------------
>
> Key: ACCUMULO-2647
> URL: https://issues.apache.org/jira/browse/ACCUMULO-2647
> Project: Accumulo
> Issue Type: Improvement
> Components: start
> Affects Versions: 1.6.0
> Reporter: Mike Drob
> Labels: newbie
> Fix For: 1.7.0
>
>
> 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.
> bq. 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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)