Details
-
Type: Bug
-
Status: Open
-
Priority: Trivial
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: jalview-j2s
-
Labels:
Description
The question is whether we care if an AlignmentViewport sequenceID is set a second time to the same value. The question only arises because new String(newId) is used instead of just newId itself. This suggests that perhaps there is some reason the involves an IdentityHashMap, since resetting that then would be a problem. But if that is not an issue, then I suggest setting the sequenceID = newId and doing a preliminary check for equivalence as in comments here.
Using new String("xxx") is not the same as "xxx", of course. HashMaps will not distinguish them, but IdentityHashMaps will, and more significantly, if this can be avoided it will speed SwingJS Hash[map/set/table] processing, because any key use of any sort that involves an object will trigger rebuilding a fast JavaScript Map to a slower "Java" one.
Using new String("xxx") is not the same as "xxx", of course. HashMaps will not distinguish them, but IdentityHashMaps will, and more significantly, if this can be avoided it will speed SwingJS Hash[map/set/table] processing, because any key use of any sort that involves an object will trigger rebuilding a fast JavaScript Map to a slower "Java" one.