3 回答

TA贡献1842条经验 获得超21个赞
==

TA贡献1827条经验 获得超8个赞
==
String.equals
this==object
.
==
==
equals
V1.0public class MyClass{ private String reference_val; ... private boolean hasReferenceVal ( final String[] strings ) { for ( String s : strings ) { if ( s == reference_val ) { return true; } } return false; } private void makeCall ( ) { final String[] interned_strings = { ... init with interned values ... }; if ( hasReference( interned_strings ) ) { ... } }}
hasReferenceVal
V2.0public class MyClass{ private String reference_val; ... public boolean hasReferenceVal ( final String[] strings ) { for ( String s : strings ) { if ( s == reference_val ) { return true; } } return false; } private void makeCall ( ) { final String[] interned_strings = { ... init with interned values ... }; if ( hasReference( interned_strings ) ) { ... } }}
equals
==
hasReferenceVal
添加回答
举报