I hope we shan't need it. Comparison of objects needs careful attention. In Java, the code above will always fail.
Strings behave in a special way here .
However your shouldn't rely on this. Since this only works for Strings anyway, you need to understand how object comparison works in general. Also, in this case, we have assumed that the ID is case-insensitive. Suppose that SwissProt contained more complex member data, such as Citation . In this case the comparison of Sequence s uses the routine written above, and it in turn uses the String comparisons within it.